Say i have a 12*2 matrix having two parameters where
a=[2;4;5;80;40;5;43;22;6;56;6;57] &
b=[100;122;132;120;108;200;231;211;165;127;130;150];
i want to get a column matrix using if else statement of 4 conditions like below.
the conditions are 2<a<10 and 110<b<130
the result will be like below, where the conditions match it will show 1 else 0
final result=[0;1;0;0;0;0;0;0;0;0;0;0]

 채택된 답변

madhan ravi
madhan ravi 2019년 1월 29일

0 개 추천

ia = a>2 & a<10 ;
ib = b>110 & b<130 ;
Final_result = ia & ib

댓글 수: 1

If I want to get answer as [0;5;0;0;0;0;0;0;0;0;0;0], then what to do?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

질문:

2019년 1월 29일

댓글:

2019년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by