MATLAB: Looping to create multiple variables

bad ideafor loopMATLABmultipleno it's a horrible ideavariables

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)

Best Answer

Don't create such variables, read here to know why
instead, do something like this,
for k = 1:50
s(:,:,k) = [reshape(randperm(32),[],1),randi(8,32,1)];
end