Borrar filtros
Borrar filtros

Restarting the comand "for"

4 visualizaciones (últimos 30 días)
Leonardo Barbosa Torres dos Santos
Leonardo Barbosa Torres dos Santos el 28 de Nov. de 2019
Respondida: JESUS DAVID ARIZA ROYETH el 28 de Nov. de 2019
Dear, I need a help.
I would like that: if a condition is met, the loop is restarted.
follow below the command that I put
Phi = 0;
for m1 = 0.0001:0.01:0.1
statements
if (reeal ~= 0)
fileID = fopen('C:\Users\real.dat','a');
formatSpec = '%1.15e\t %1.15e\r\n';
fprintf(fileID,formatSpec,...
Phi_degree,...
m1);
fclose(fileID);
Phi_degree = Phi_degree+5;
m1 = 0.0001;
else
end
end
The problem is that this way it does not reset the value m1. It continues as if I had not set m1 = 0.0001
Could you help me, please ?

Respuestas (1)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH el 28 de Nov. de 2019
solution:
a=true;
while a
for m1 = 0.0001:0.01:0.1
statements
if (reeal ~= 0)
fileID = fopen('C:\Users\real.dat','a');
formatSpec = '%1.15e\t %1.15e\r\n';
fprintf(fileID,formatSpec,...
Phi_degree,...
m1);
fclose(fileID);
Phi_degree = Phi_degree+5;
m1 = 0.0001;
break;
else
end
end
a=m1==0.0001;
end

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by