複数条件の繰り返し分( for, if)
Mostrar comentarios más antiguos
"~かつ~" といった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を使って表現したいです.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre ループと条件付きステートメント en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!