if_elseif
用MATLAB写了个这样的程序
if ((0 < pwr <=2) )
wf_temp1 = round(temp_wf0/2^7);
elseif( (2 < pwr<= 4) )
wf_temp1 = round(temp_wf0/2^8);
elseif((4 < pwr <= 8))
wf_temp1 = round(temp_wf0/2^9);
Else
wf_temp1 = round(temp_wf0/2^10);
end
但是程序好像不能执行,改成下面才可以的。
if ((0 < pwr)&&(pwr <=2) )
wf_temp1 = round(temp_wf0/2^8);
elseif( (2 < pwr)&&( pwr<= 4) )
wf_temp1 = round(temp_wf0/2^9);
else((4 < pwr)&&( pwr <= 8))
wf_temp1 = round(temp_wf0/2^10);
end