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

採用された回答

KSSV
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 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by