How to correct for 'Undefined function 'eq' for input arguments of type 'cell'' error message
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Matt J
am 7 Aug. 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 Kommentare
Walter Roberson
am 11 Aug. 2015
indices = cell2mat(out(:,1));
LocationSquare(indices) = out(indices,2);
No loop.
Note: this relies upon out(:,1) always being valid and unique.
4 Kommentare
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!