Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 20 Mag 2021
Modificato: Stephen23 il 20 Mag 2021
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 il 20 Mag 2021
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...

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by