How to go back to check condition again after the if-else statement
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
This is my coding,
cond=exp(z(2)*(1-z(1)))-(1/z(3));
if cond<0
h=@test;
znew=simulannealbnd(h,z,[0 0 0],[1.0 10.0 1.0],options)
else
r1 = a1 + (b1-a1).*rand(1,1);
r2= a2 + (b2-a2).*rand(1,1);
r3= a3 + (b3-a3).*rand(1,1);
z=[r1 r2 r3];
end
After getting the z=[r1 r2 r3], i want to go back to check the condition again. How to write the code?
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 21 de Ag. de 2013
Editada: Azzi Abdelmalek
el 21 de Ag. de 2013
test=0;
while test==0
cond=exp(z(2)*(1-z(1)))-(1/z(3));
if cond<0
h=@test;
znew=simulannealbnd(h,z,[0 0 0],[1.0 10.0 1.0],options)
test=1;
else
r1 = a1 + (b1-a1).*rand(1,1);
r2= a2 + (b2-a2).*rand(1,1);
r3= a3 + (b3-a3).*rand(1,1);
z=[r1 r2 r3];
test=0;
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Outputs 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!