How to use the if condition in matlab?

조회 수: 3 (최근 30일)
Abirami
Abirami 2015년 1월 28일
댓글: Abirami 2015년 1월 29일
Hello I have doubts in using if condition in matlab.I have to perform the following operation in a cell.
Final={ S1 if B{i}=11
S1 if B{i}=10
S2 if B{i}=01
S2 if B{i}=00
I have the 2 bit binary values as a 128x17 cell. How to perform this and create a new matrix Z where i get the values of S1 and S2.
B= 00 10 11 10 11
01 01 01 01 11
10 00 01 00 01
10 10 01 01 11
10 10 10 00 10
and if
S1= 21
23
28
25
43
S2= 96
85
78
65
76
For each binary value, the corresponding S value should be present.So my Z would be
Z = s2 s1 s1 s1 s1
s2 s2 s2 s2 s1
s1 s2 s2 s2 s2
s1 s1 s2 s2 s1
s1 s1 s1 s2 s1
ie Z= 96 21 21 21 21
85 85 85 85 23
28 78 78 78 78
25 25 65 65 25
43 43 43 76 43
ie; with the values of S1 and S2, the data in B is to be replaced.please help. thanks in advance

답변 (1개)

Star Strider
Star Strider 2015년 1월 28일
Please give an example of what Z should be given the appropriate values of B, S1, and S2. S1 and S2 are matrices, and in your Final assignment, B are addressed as elements. What elements of S1 and S2 should replace particular elements of B? This is not at all clear.
  댓글 수: 1
Abirami
Abirami 2015년 1월 29일
I have edited the question sir...please help...thanks in advance...

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

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by