MATLAB: How to make matrix choose

if statement

Upload your code

Best Answer

>> m=[60;90;90;180;125.3;90;60;45;135]
N=zeros(1,numel(m)); % your N should be here instead of this
N(m==0 | m==180)=0;
N(m==90)=1;
N(m==45 | m==135)=0.5;
N = N'
m =
60.0000
90.0000
90.0000
180.0000
125.3000
90.0000
60.0000
45.0000
135.0000
N =
0
1.0000
1.0000
0
0
1.0000
0
0.5000
0.5000
>>