Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

the command "clc" and "clear all" does not work on a script in the editor.

Asked by Artur M. G. Lourenço on 12 Jul 2012

The commands "clc" and "clear all" don't work in my script, somentimes yes.

i have matlab 2011 a and b e 2012 a.

0 Comments

Artur M. G. Lourenço

Products

No products are associated with this question.

5 Answers

Answer by Artur M. G. Lourenço on 12 Jul 2012
Accepted answer

inglêsportuguêsespanhol

I found that putting too many comments before or after the command "clc" and "clear all" in the script, they do not work.

It happens to someone?

5 Comments

Jan Simon on 12 Jul 2012

So you assume that Matlab has a magic limit of 18 comment lines, which influences the ability of some commands to work? After working with Matlab and participating in some Matlab forums for so many years now, I've never seen or heard of another magic behavior. Therefore I'm convinced, that either your test, if "clear all" has worked, is wrong, or there is another problem e.g. you have defined a variable called 'all'. Then clear all clears this variable only. But this will not and no circumstances depend on the number of comment lines surrounding the command.

Please post the relevant part of your code.

Image Analyst on 12 Jul 2012

I can't reproduce. It works fine for me.

Artur M. G. Lourenço on 26 May 2013

Hi guys I do not know why, but I found that when placed at the beginning of a script "clear all" and "clc" using the ANN toolbox (Neural) occurred a bug and the variables in my workspace were not clean, the problem was this. I now use the 2013 and all is well! Thank you all!

Artur M. G. Lourenço
Answer by Greg Heath on 12 Jul 2012

They are not defined to work in the editor.

They work on the command line and when the corresponding script or function is executed

0 Comments

Greg Heath
Answer by Walter Roberson on 13 Jul 2012

Exactly what is it that you think that "clc" and "clear all" do ?

If someone is requiring that you put in clc and "clear all", such as if you will fail an assignment if you do not put them in, then just go ahead and put in and do not worry about what they do or do not do under any particular circumstances. If someone requires that you put them in, then that person is taking responsibility for any program failure that might result.

If no-one is requiring that you put in clc and "clear all", then eliminate any problems with them by simply not putting them in.

http://linguaspectrum.com/lessons/language_lessons/English%20Humour/English%20Humour/page_06.htm

"Doctor, doctor, every time I drink a cup of coffee I get a sharp pain in my nose."
"Have you tried taking the spoon out of the cup?"

0 Comments

Walter Roberson
Answer by Artur M. G. Lourenço on 26 May 2013

I was misunderstood in my question or did poorly.

1 Comment

Walter Roberson on 26 May 2013

I don't think you were misunderstood, but we are having difficulty believing it. Unless, that is, you had the "clear all" within a script that was being invoked from something else: if that is what is happening then it wouldn't surprise us at all that you had the problem.

Artur M. G. Lourenço
Answer by Greg Heath on 26 May 2013

HEY!

Why are you using the answer box for your questions and comments?

Just so you can accept your own question as the correct answer?

Since my answer was the first correct one, YOU OWE ME!

Greg

3 Comments

Artur M. G. Lourenço on 26 May 2013

sorry I just took to finish the discussion. How do I undo and accept your answer? However niguém answered the question, it was just a bug in matlab. You will not find more accurate erase that doubt?

Jan Simon on 26 May 2013

@Eng_Amb: Who is niguem? I do not see the anything in this thread, which implies a Matlab bug. Your problem has not become clear to me yet and the opinion, that there is a connection to the number of comments before and after the the command is obviously wrong.

Artur M. G. Lourenço on 27 May 2013

sorry "ninguem" is anybody. So I will try to explain as best as possible. When I write a code in the editor I put "Clear all" and "clc" to clear the variables in the workspace and something written in the command window. When put many comments in my code, simply "Clear all" and "clc" did not work. I do not know why. I used the ANN toolbox. I used the 2012 version, but now I have to 2013 and everything is working normally. I will give you my code for you to open and test if you have matlab 2012.

https://docs.google.com/file/d/0B9JmyPHF_ZMPcDNNU1VIV01iakU/edit?usp=sharing

Is solved now, thank you all for the help.

Greg Heath

Contact us