How to correct for 'Undefined function 'eq' for input arguments of type 'cell'' error message
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a simple bit of code and keep getting an error message,
>>
for Area = 1:652
if Area == out(:,1)
DateofB = out(:,2)
LocationSquare(Area) = DateofB
end
end
Undefined function 'eq' for input arguments of type 'cell'.
I've tried using curled braces instead in my if statement but that doesn't work.
I've also tried using an isequal term instead too but it doesn't like that either.
Am I going about this in the wrong way?
Thanks for any help, advice, direction that can be spared.
6 Commenti
Risposte (2)
Matt J
il 7 Ago 2015
I've tried using curled braces instead in my if statement but that doesn't work.
See what you get when you do the following,
>> A={1,2,3};
>> if A{1}==1, disp 'Hello World', end
Hello World
>> if A==1, disp 'Hello World', end
Undefined operator '==' for input arguments of type 'cell'.
0 Commenti
Walter Roberson
il 11 Ago 2015
indices = cell2mat(out(:,1));
LocationSquare(indices) = out(indices,2);
No loop.
Note: this relies upon out(:,1) always being valid and unique.
4 Commenti
Vedere anche
Categorie
Scopri di più su Entering Commands 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!