Info

此问题已关闭。 请重新打开它进行编辑或回答。

more for loop help

1 次查看(过去 30 天)
James
James 2011-8-7
关闭: MATLAB Answer Bot 2021-8-20
for c = 11:20
if c~=11 && c~=14 && c~=17 && c~=20
break
end
% how can I loop through for all values of r, which are r=11,14,17,20????
end

回答(2 个)

bym
bym 2011-8-7
for k = 11:3:20
%do stuff
end

Walter Roberson
Walter Roberson 2011-8-7
Or you could use
for k = [11,14,17,20]
%do stuff
end

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by