Filter löschen
Filter löschen

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

9 Ansichten (letzte 30 Tage)
cat cat
cat cat am 12 Jan. 2016
Bearbeitet: Stephen23 am 12 Jan. 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

Akzeptierte Antwort

Stephen23
Stephen23 am 12 Jan. 2016
Bearbeitet: Stephen23 am 12 Jan. 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):

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by