elseif in not executing. how to rectify this.

3 ビュー (過去 30 日間)
rajesh kumar
rajesh kumar 2018 年 5 月 20 日
編集済み: Stephen23 2018 年 5 月 21 日
Y=[0.946;0.2212;0.4123;0.90191;0.5432;.01546]
Y_min=min(Y);
Y_max=max(Y);
for i=1:6
if Y(i)<=Y_min
Y_m(i,:)=1;
elseif Y_min < Y(i) < Y_max
Y_m(i,:)=(Y_max-Y(i))/(Y_max-Y_min);
end

回答 (1 件)

Stephen23
Stephen23 2018 年 5 月 20 日
編集済み: Stephen23 2018 年 5 月 21 日
The syntax A<X<B does not do what you think it does. You will need to use two comparisons:
elseif Y_min<Y(i) && Y(i)<Y_max
Note that the syntax that you used is equivalent to this:
(A<X)<B
You can learn why by reading the MATLAB documentation:

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by