How to use not equal in for loop

14 次查看(过去 30 天)
Kaiyu Nie
Kaiyu Nie 2020-8-10
Is it possiable to use ~= in for loop like
for t ~= 1
xxx
xxx
xxx
end

回答(1 个)

James Tursa
James Tursa 2020-8-10
编辑:James Tursa 2020-8-10
You could use a while loop. E.g.,
t = 0;
while( t ~= 1 )
% code
% at some point, either set t=1 or break out of loop
end

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by