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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by