Azzera filtri
Azzera filtri

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

9 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Stephen23
Stephen23 il 12 Gen 2016
Modificato: Stephen23 il 12 Gen 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):

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by