How to arrange answers for iterations

1 view (last 30 days)
Arjun
Arjun on 31 May 2014
Commented: Arjun on 1 Jun 2014
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

Accepted Answer

the cyclist
the cyclist on 31 May 2014
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))

More Answers (0)

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!