MATLAB中的 continue 語(yǔ)句跟 break 語(yǔ)句有點(diǎn)像,但 break 是強(qiáng)制終止,continue 強(qiáng)制下一次迭代的循環(huán)發(fā)生,跳躍中的任何代碼之間。
MATLAB continue 語(yǔ)句流程圖:

詳細(xì)例子:
在MATLAB中建立一個(gè)腳本文件,并輸入下述代碼:
a = 10; %while loop execution while a < 20 if a == 15 % skip the iteration a = a + 1; continue; end fprintf('value of a: %d ', a); a = a + 1; end
運(yùn)行該文件,顯示下述結(jié)果:
value of a: 10 value of a: 11 value of a: 12 value of a: 13 value of a: 14 value of a: 16 value of a: 17 value of a: 18 value of a: 19
更多建議: