I want to only run my loop till 22 but it shoud take odd numbers for x_random and even for y_random
1 回表示 (過去 30 日間)
古いコメントを表示
while i < 22
if mod(i,2)==0
P(2,i) = y_random(i); %y coordinate
else
P(1,i) = x_random(i); %x coordinate
end
end
0 件のコメント
採用された回答
KSSV
2022 年 10 月 4 日
for i=1:22
if mod(i,2)==0
P(2,i) = y_random(i); %y coordinate
else
P(1,i) = x_random(i); %x coordinate
end
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!