Filter löschen
Filter löschen

Restarting the comand "for"

4 Ansichten (letzte 30 Tage)
Leonardo Barbosa Torres dos Santos
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 ?

Antworten (1)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 28 Nov. 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

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by