Ignore values in array in switch case

조회 수: 1 (최근 30일)
Jayant
Jayant 2020년 4월 9일
댓글: Mehmed Saad 2020년 4월 9일
Hello all, hope all are safe at home.
i want to use switch case loop for comparing the array of 4 values, which are either 0 or 1.
something like this:
array1=[1 0 0 1] or [0 0 0 0] or [1 1 1 1] or anything.... 16 possiblities...
now i want compare all 4 positions, whether it is 1 or 0, Ignoring other positions.
Like:
switch array1
case [1 ~ ~ ~]
do this....
case [~ 1 ~ ~]
do this....
and so on..... So there will be only 4 cases.
But matlab shows error for use of symbol ~ here.
In short, i want to ignore the other values in array except one.
ANY SOLUTION?????
  댓글 수: 1
Mehmed Saad
Mehmed Saad 2020년 4월 9일
Why are you using switch statement when there are much easier way to do that.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Word games에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by