Syntax bug R2011a: x ==y
Afficher commentaires plus anciens
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 commentaires
Thomas
le 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
le 20 Sep 2012
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Desktop dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!