I want to only run my loop till 22 but it shoud take odd numbers for x_random and even for y_random
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Bushra Atta Khakwani khakwani
il 4 Ott 2022
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 Commenti
Risposta accettata
KSSV
il 4 Ott 2022
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!