Info
此问题已关闭。 请重新打开它进行编辑或回答。
Nested for loops help!
2 次查看(过去 30 天)
显示 更早的评论
If i have
m1(n,1)=(m2(n,1)+((m3(n,1))*p));
Where m1 m2 and m3 are all arrays. if i wanted the range of n=1:42, and the range of p=1:31, how could i tell matlab to calculate l=1:31 for every different value of n?
0 个评论
回答(2 个)
BAN
2015-9-24
编辑:James Tursa
2015-9-24
Try using this:
for n = 1:42
for p=1:31
m1(n,1)=(m2(n,1)+((m3(n,1))*p));
end
end
Here, for every value of n, that equation will be executed 31 times.
Hope it helps !!
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!