Borrar filtros
Borrar filtros

Could anyone help me to solve the error undefined operator

1 visualización (últimos 30 días)
jaah navi
jaah navi el 20 de Jun. de 2021
Editada: Jonas el 20 de Jun. de 2021
Undefined operator '==' for input arguments of type 'cell'.
Error in five (line 32)
acc = sum(YPred == YTest)./numel(YTest);

Respuestas (1)

Jonas
Jonas el 20 de Jun. de 2021
Editada: Jonas el 20 de Jun. de 2021
YPred and/or YTest are cells which can contain any kind of data, also tables, graphical objects. for that reason there is no operator for the cell. it you want to compare the content of the cell and it contains e.g. a matrix, you can use cell2mat on your variables in the formular or use suitable brackets (e.g. YPred{:} )
  2 comentarios
jaah navi
jaah navi el 20 de Jun. de 2021
Could you help me how the formula acc = sum(YPred == YTest)./numel(YTest) can be written.
I tried with acc = sum(YPred{:}, YTest{:})./numel(YTest) and getting error again.
Jonas
Jonas el 20 de Jun. de 2021
Editada: Jonas el 20 de Jun. de 2021
sum(YPred{:}==YTest{:})/ numel(YTest{:})
should work, you forget the comparison operator ;) and it then has to be numel(YTest{:})

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by