Undefined operator '-' for input arguments of type 'cell'.

1 回表示 (過去 30 日間)
lily genius
lily genius 2018 年 10 月 31 日
回答済み: YT 2018 年 10 月 31 日
Hello I am trying to optimize a function and I defined the objective function as follow:
Tp=Scope{1,1}.values(2:36,7);
T1= Scope{1,1}.values(2:36,9);
To= cell(35,1);
To{1}=888;
for i=2:36
To{i} = @(k) To{i-1} + (k)*(T1(i)- To{i-1} )
end
obj=(sum(Tp - To).^2)
when running the function I keep getting Undefined operator '-' for input arguments of type 'cell'.

採用された回答

YT
YT 2018 年 10 月 31 日
A question similar to this one was asked before and answered here
You can try to figure it out for yourself by checking some of the following things
  1. Dimensions of the arrays not the same
  2. The contents of the arrays cannot be used for mathematical operations e.g. strings
  3. To access cell content, you should use {} instead of ()

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by