How to arrange answers for iterations

1 visualización (últimos 30 días)
Arjun
Arjun el 31 de Mayo de 2014
Comentada: Arjun el 1 de Jun. de 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

Respuesta aceptada

the cyclist
the cyclist el 31 de Mayo de 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))

Más respuestas (0)

Categorías

Más información sobre Argument Definitions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by