Undefined operator '==' for input arguments of type 'cell'. Error in Elenco (line 13) if tell(i)==c
1 view (last 30 days)
Show older comments
function [num_dis]=Elenco(codice,tell,drat,esecuzione,c,d,e)
N=length(tell);
j=1;
num_dis=[];
temp=[];
g=false;
f=false;
l=false;
for i=1:N
if tell(i)==c
g=true;
end
if drat(i)~=d
g=false;
end
if esecuzione(i)~=e
l=false;
end
if g==true
temp(j)=codice(i);
j=j+1;
else i=i+1;
end
end
for k=1:10
num_dis(k)=temp(k);
end
end
2 Comments
Stephen23
on 3 Nov 2017
Edited: Stephen23
on 3 Nov 2017
@Alcapalb: your code is very badly aligned. Badly aligned code is one way that beginners hide bugs in their code. You should align your code using the MATLAB Editor's default settings. You can also align the code in the Editor: select all the code, then click ctrl+i.
Answers (1)
James Tursa
on 3 Nov 2017
You don't tell us much about what the variable types and sizes are, so we can only guess. Maybe you need this:
if tell{i}==c
or maybe this:
if isequal(tell{i},c)
If you could tell us the variable types and sizes we could help more.
3 Comments
JP
on 6 Feb 2018
In order to make this post useful for other visitors maybe you should point out what the error actually was?
Mostafa Abdelrehim
on 4 Jul 2018
I got the same bug, and I solved it by changing if tell{i}==c to if isequal(tell{i},c) so I think Alcapalb did the same
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!