What is wrong with my code

2 ビュー (過去 30 日間)
kvsn raju
kvsn raju 2016 年 6 月 29 日
コメント済み: Rahul agarwal 2016 年 6 月 29 日
The error message shown is :
Operands to the and && operators must be convertible to logical scalar values.
Error in MainCode>cal_for_tune (line 412)
%----------FIXING THE MAX TIP HEIGHT-----------------------------------------------
My code near that line :
line 411 % ----------------------------------------------------------------------------------
line 412 % ----------FIXING THE MAX TIP HEIGHT-----------------------------------------------
line 413 if((TH_max1 >= 0.4) && (TH_max2 >= 0.4) && (TH_max3 >= 0.4))
BM_Lvr1_max_adj = lim_up_down(10*abs(TH_max1-0.4),0,3);
BM_Lvr2_max_adj = lim_up_down(10*abs((TH_max2+TH_max3)/2-0.4),0,3);
  1 件のコメント
Rahul agarwal
Rahul agarwal 2016 年 6 月 29 日
the conditions you are checking in the Line 413 is not able to give logical scalar values, check the class of TH_max1, TH_max2, TH_max3. it should be array, not cell.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 29 日
One of your TH_max* variables is empty or is not a scalar. When you use && then the results of each individual test must be a scalar.

その他の回答 (1 件)

Jan Orwat
Jan Orwat 2016 年 6 月 29 日
Are TH_max1:3 scalars, vectors or arrays? && and may be used only with scalars. Try:
if(all(TH_max1(:) >= 0.4) && all(TH_max2(:) >= 0.4) && all(TH_max3(:) >= 0.4))

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by