loops - creating multiple matrices in matlab through looping -


i have turn list of numbers (ex. 4 1 3 2) list of same numbers multiple copies of each number (and have in specific order) (ex. 4 4 4 4 1 1 1 1 3 3 3 3 2 2 2 2)

right plan make 4x1 matrix of each 1 ( = [ 4 4 4 4]) i'm having trouble making run every number in list. made function takes in value (4) , makes matrix of contains 4 copies of in 4x1 through loop.

can make loop runs copy each number in list?

aftewrads think can use vertcat combine matrices list i'm looking for.

thanks!

no need loop in case.

with constant length each entry in val = [4 1 3 2], repmat() , reshape():

len = 4; reshape(repmat(val,len,1),1,[]) 

or variable lengths, decode fex:rude()

len = [1 2 3 4]; rude(len,val) 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -