Hi,
I've been experiencing bugs in the 2016a update of Matlab. When I open and run a certain script, which worked fine in the previous edition, I keep getting errors that I'm using undeclared variables such as '%U23' and '%U440'. I keep adding code to clear these in the top, however, it just keeps adding these random variables every I open the program. Let me know if you have any suggestions on a solution to my problem!
Thanks in advance,
Isabelle

1 comentario

Walter Roberson
Walter Roberson el 14 de Jun. de 2016
Please post the script and an exact copy of one of the error messages.
Which language edition of MATLAB are you using? Is any of your code written using non-English characters ?

Iniciar sesión para comentar.

 Respuesta aceptada

Isabelle agostini
Isabelle agostini el 14 de Jun. de 2016

0 votos

Error using Simulink.findVars Invalid variable name '%Ucd8'. Names must follow the same rules as MATLAB variable names
Error in UnusedVariables (line 20) unusedVars = Simulink.findVars('CompleteServo_x_System','FindUsedVars',false,'SourceType', 'base workspace');

Más respuestas (2)

Andreas Goser
Andreas Goser el 14 de Jun. de 2016

0 votos

As th "%" is for comments, I wonder if you are talking about MATLAB code in the first place. But as Walter said, the more specifc, the better.
In general, please make sure bugs are reported to MathWorks support. Even if you get workarounds in this user forum, it is important to makes sure MathWorks Development consistenly knows about bugs.

6 comentarios

Isabelle agostini
Isabelle agostini el 14 de Jun. de 2016
Editada: Stephen23 el 14 de Jun. de 2016
This is where I'm confused as well...
clear i;
clear DoubleVariables;
clear CharVariables;
clear Others;
clear DoubleVariablesName;
clear CharVariablesName;
clear OthersName;
clear unusedVars;
clear '%U3c'; % This is a bug in the system for 2016a
clear '%U3d'; % Same
clear '%U23'; % same, however it only appeared when opening the program next time
clear '%U24'; % same
clear '%U22'; % third time opening MATLAB 2016a
clear '%U43';
clear '%U43f';
clear '%U440';
unusedVars = Simulink.findVars('CompleteServo_x_System','FindUsedVars',false,'SourceType', 'base workspace');
floatcounter = 1;
charcounter = 1;
otherscounter = 1;
% DoubleVariablesName{} = [];
for i = 1:length(unusedVars);
evalin('base',['valueVar =' unusedVars(i).Name ';']);
if isfloat(valueVar)
DoubleVariables(floatcounter) = unusedVars(i);
DoubleVariablesName{floatcounter} = [DoubleVariables(floatcounter).Name];
floatcounter = floatcounter + 1;
elseif ischar(valueVar)
CharVariables(charcounter) = unusedVars(i);
CharVariablesName{charcounter} = [CharVariables(charcounter).Name];
charcounter = charcounter + 1;
else
Others(otherscounter) = unusedVars(i);
OthersName{otherscounter} = [Others(otherscounter).Name];
otherscounter = otherscounter + 1;
end
% end
end
Adam
Adam el 14 de Jun. de 2016
What are you trying to achieve with this line?
clear '%U3c';
I'm not familiar with Simulink so maybe it behaves very differently, but in standard Matlab clear is for clearing variables. It doesn't make any sense to basically clear an in-place string.
Walter Roberson
Walter Roberson el 14 de Jun. de 2016
clear('%U3c') would make more sense -- if you could have a variable with that name at all. But it looks to me more like it would be a unicode escape sequence, perhaps even a modification of "percent encoding"
Guillaume
Guillaume el 14 de Jun. de 2016
If the file is opened in a text editor other than matlab, do the weird characters also show up?
Isabelle agostini
Isabelle agostini el 14 de Jun. de 2016
I put that line in after I had been told there was a variable with that name somewhere, to get rid of the error... And the characters don't actually show up, Matlab just gives me an error in the command window saying they do
Guillaume
Guillaume el 14 de Jun. de 2016
As per Walter's earlier comment please post the entire error message that get displayed, not your interpretation of it.
Also, what is the output of
who

Iniciar sesión para comentar.

Isabelle agostini
Isabelle agostini el 16 de Jun. de 2016

0 votos

Exactly... my point is that it has to be a bug because of the '%', since it shouldn't matter what I type after since it would be a comment... and clearly not part of the code which is why it's really annoying. How can I report it to Mathworks?

2 comentarios

Steven Lord
Steven Lord el 16 de Jun. de 2016
Use the "Contact Us" link in the upper-right corner of this page.
Walter Roberson
Walter Roberson el 16 de Jun. de 2016
I think it likely that the file is corrupted or being read as if it is corrupted, and that the % notation is encoding of characters and not actually present anywhere.

Iniciar sesión para comentar.

Productos

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by