Borrar filtros
Borrar filtros

Undefined function 'eq' for input arguments of type 'cell'.

9 visualizaciones (últimos 30 días)
cat cat
cat cat el 12 de En. de 2016
Editada: Stephen23 el 12 de En. de 2016
Hi! I don't understand because my code gives an error
if (prefixTree(1,4).prefixTree2(:,2)=='2')
unique(prefixTree(1,4).prefixTree2(:,3))
end
Error:
Undefined function 'eq' for input arguments of type 'cell'.
Thanks

Respuesta aceptada

Stephen23
Stephen23 el 12 de En. de 2016
Editada: Stephen23 el 12 de En. de 2016
Relational operators can be used with numeric arrays or character arrays. It makes no sense to use them with cell arrays. Consider the following:
>> {3}==3 % cell array
Undefined function 'eq' for input arguments of type 'cell'.
>> 3==3 % numeric array
ans =
1
if you wish to test for a particular string, use strcmp:
>> strcmp('3','3')
ans =
1
>> strcmp({'3'},'3')
ans =
1
Here some of the other questions asked by people trying to perform numeric operations on cell arrays (which is always an error, as numeric operations can only be performed on numeric arrays):

Más respuestas (0)

Categorías

Más información sobre Data Types 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