複数条件の繰り返し分( for, if)
Mostra commenti meno recenti
"~かつ~" といった2つの条件を満たす繰り返しの文を表現したいです.
A=[1 50;2 51;1 53;2 55;1 56;2 52]
P1=55
P2=52
【条件】
*Aの1列目が"1"かつ,P1<=Aの2列目 この2つの条件を満たすとき⇒ "1"と表示
満たさないとき⇒ "0"と表示
*Aの1列目が"2"かつ,P2<=Aの2列目 この2つの条件を満たすとき⇒ "2"と表示
満たさないとき⇒ "0"と表示
B=[0 0 0 2 1 2]
表示したものを上の様にBに数値として格納
これらをforを使って表現したいです.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su ループと条件付きステートメント in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!