Clear Filters
Clear Filters

Looping to create multiple variables?

38 views (last 30 days)
Amos Tan
Amos Tan on 13 Oct 2017
Commented: Amos Tan on 14 Oct 2017
I would like to run the following code 50 times, each time saving the output into a new variable (eg. s1, s2, s3,...,s50)
s = [reshape(randperm(32),[],1),randi(8,32,1)];
How would I do that?
Thank you! (sorry if this is a very trivial question, I'm new)
  2 Comments
Adam
Adam on 13 Oct 2017
You should never want 50 variables in your workspace when 1 would do!
Amos Tan
Amos Tan on 14 Oct 2017
thank you for the advice! (:

Sign in to comment.

Accepted Answer

KL
KL on 13 Oct 2017
Edited: KL on 13 Oct 2017

More Answers (1)

Image Analyst
Image Analyst on 13 Oct 2017

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!