Syntax bug R2011a: x ==y
Ältere Kommentare anzeigen
In coming up with an answer to another question I was playing around and think I found a bug in R2011a in Linux. Can anyone explain
>> x = randi(2, 10, 1)-1; % Dummy data
>> x == 0;
>> x ==0;
??? Error: "x" was previously used as a variable,
conflicting with its use here as the name of a function or command.
See MATLAB Programming, "How MATLAB Recognizes Function Calls That Use
Command Syntax" for details.
The 2nd and 3rd line differ in the presence (works) and absence (errors) of a space after ==. I cannot think of why the space matters. The error message also doesn't make sense to me. Is this reproducible? Is it a bug?
3 Kommentare
Thomas
am 20 Sep. 2012
Same error on the Mac as well.. R2012b.
I think the space (absence or presence of which causes it to identified as a variable or a function as is described in the help section 'How MATLAB Recognizes Command Syntax'
Daniel Shub
am 20 Sep. 2012
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Desktop finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!