Error: Unable to perform assignment because the left and right sides have a different number of elements.

1 次查看(过去 30 天)
I am unable to get this for loop working for some reason, I know it is in line 28 but not sure. Thanks for any help.

采纳的回答

fred  ssemwogerere
fred ssemwogerere 2020-2-13
编辑:fred ssemwogerere 2020-2-13
You are using a double for loop. I advise its best to use something like this
for ii=1:24
for jj=1:24
z(ii,jj)=normrnd(mu_SC(ii),std_SC(jj),1000);
end
end
  3 个评论
fred  ssemwogerere
fred ssemwogerere 2020-2-13
Hello, from your question i think you are tring to generate a 1000x1000 array of normal random numbers, then in that case you can use cell notation, with curly brackets to the output as below:
for ii=1:24
for jj=1:24
z{ii,jj}=normrnd(mu_SC(ii),std_SC(jj),1000);
end
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by