Operator '-' is not supported for operands of type 'table' even with {}

1 回表示 (過去 30 日間)
Andrea Sbaragli
Andrea Sbaragli 2021 年 5 月 20 日
編集済み: Jan 2021 年 5 月 20 日
I have to perform this operation in which all entities, namely d12, T1 and T2 are in table format:
d12{i,1} = norm(T1{i,3:end} - T2{i,3:end} );
In other questions the problem was solved using the right brackets but this seems not to be my case..
  7 件のコメント
Stephen23
Stephen23 2021 年 5 月 20 日
編集済み: Stephen23 2021 年 5 月 20 日
Quite likely that T1 and/or T2 are not numeric array inputs when the function is called.
What is the complete error message that you get? This means all of the red text.
Andrea Sbaragli
Andrea Sbaragli 2021 年 5 月 20 日
Since arrays stamp1 and stamp2 are in datetime format, and in report12 must coexist double and datetime values I decided to switch all inputs to table format because mixing them in arrays does not work. Moreover, before start the function T1 and T2 dimensions are as it follows:
1- T1 = jx4 double
2- T2 = kx4 double
where j and k are, of course, integers
Currently, the error seems solved but I have this one regarding mixing datetime and double in line 24 (report12(i,1)=stamp1(i,1))
The following error occurred converting from datetime to double:
Undefined function 'double' for input arguments of type 'datetime'. To convert from datetimes to numeric, first subtract off a datetime origin, then convert to numeric using the SECONDS,
MINUTES, HOURS, DAYS, or YEARS functions.
Kind of wierd considering that report12 is initialized as a table...

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by