How to convert this ...for loop to while loop ?

1 Ansicht (letzte 30 Tage)
Hocine hoho
Hocine hoho am 10 Apr. 2021
Beantwortet: David Fletcher am 10 Apr. 2021
for i=1:5
for j=1:20
amp=i*1.2;
wt=j*0.05;
v(i,j)=amp*sin(wt);
end
end

Akzeptierte Antwort

David Fletcher
David Fletcher am 10 Apr. 2021
i=1;
while i<=5
j=1;
while j<=20
amp=i*1.2;
wt=j*0.05;
v(i,j)=amp*sin(wt);
j=j+1;
end
i=i+1;
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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