MATLAB Answers

How to assign values to a variable size array

7 views (last 30 days)
Asaf McRock
Asaf McRock on 21 Feb 2021
Commented: Asaf McRock on 21 Feb 2021
The following works fine
k=[];
for jj=1:10
k(jj,:)=randi(10,1,3);
end
However, I'm facing difficulties when I try to assign different rows' elements to variable size array k:
k=[];
for jj=1:10
k(1,:)=randi(10,1,jj);
end
I would appreciate your help.
  6 Comments
Asaf McRock
Asaf McRock on 21 Feb 2021
Thank you, gentlemen!
I'm learning so much from you. Much appreciated!

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by