Populate MATLAB array with the same values -


in haskell, if wanted 10 element list contained number 5, this:

take 10 $ repeat 5 

output:

[5,5,5,5,5,5,5,5,5,5] 

is there in matlab?

it easy assign repeated values array:

 x(1:10) = 5; 

if want generate array of elements inline in statement try this:

ones(1,10) * 5 

or

repmat(5, 1, 10) 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -