How to arrange answers for iterations

1 次查看(过去 30 天)
I have the following iteration running.
a=20000:5000:90000
for ct1=1:1:length(a)
b=300:20:460
for ct2=1:1:length(b)
c=150:10:300
for ct3=1:1:length(c)
d=0.5:0.1:0.8
for ct4=1:1:length(d)
e=2000:100:2300
for ct5=1:1:length(e)
x(ct1,ct2,ct3,ct4,ct5)=a(ct1)+ b(ct2)- (c(ct3))^2 + d(ct4)+ e(ct5)
end
end
end
end
end
how can I program it such that I will have all the value arranged accordingly each time the iteration runs. Example
a=20000, b=300, c=150, d=0.5, e=2000, x=-199.5
then it updates for each other iterations. tq

采纳的回答

the cyclist
the cyclist 2014-5-31
Put this line in your code, just after you assign the value to x:
sprintf('a=%d, b=%d, c=%d, d=%f, e=%d, f=%f',a(ct1),b(ct2),c(ct3),d(ct4),e(ct5),x(ct1,ct2,ct3,ct4,ct5))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by