How to arrange answers for iterations

1 visualizzazione (ultimi 30 giorni)
Arjun
Arjun il 31 Mag 2014
Commentato: Arjun il 1 Giu 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

Risposta accettata

the cyclist
the cyclist il 31 Mag 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))

Più risposte (0)

Categorie

Scopri di più su Argument Definitions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by