Info

This question is closed. Reopen it to edit or answer.

How to tell MATLAB to go to the next replication i

1 view (last 30 days)
Mikie
Mikie on 10 Mar 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, I am new for MATLAB. Please, help me.
for i = 1:100
....
while .....
if WHATEVER
end
end
end
If WHATEVER is not true, how can I tell MATLAB to skip to the next replication i ? Please help me. Thank you so much.

Answers (1)

David Fletcher
David Fletcher on 10 Mar 2018
if WHATEVER=false
break;
end
  4 Comments
Mikie
Mikie on 11 Mar 2018
Thank you so much. Also, how can I tell MATLAB not to keep "Empty sym: 0-by-1" to p? Skip it and collect only scalar p.
Walter Roberson
Walter Roberson on 11 Mar 2018
counter = 0;
all_p = sym([]);
for i = 1 : 100
...
if isempty(p); continue; end
counter = counter + 1;
all_p(counter) = p;
end

This question is closed.

Community Treasure Hunt

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

Start Hunting!