How to assign values to 100 by 2 matrix?
Show older comments
I have a matrix (2,3); how could I initialize a 100 by 2 matrix with the first column all=2 and second column all=3.
Thank you!
Accepted Answer
More Answers (2)
A=[2 3]
A1=[A(1)*ones(100,1) A(2)*ones(100,1)]
Murugan C
on 15 May 2019
x=ones(100,2);
x(1:end,1) =2;
x(1:end,2) =3;
Try the above code.
Thanks in advance!!!
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!