Why nothing is being plotted and this code is being appeared constantly? (Attempt to execute SCRIPT cla as a function:)
Show older comments
Hi everyone,
So, apparently my MATLAB no longer likes to plot stuff and I do not know why. I tried some earlier suggestions such as that Rehash thing butthey didn't work. It is noteworthy to mention that my MATLAB has been installed to drive F not C. Could you please help me?
Thanks in advance!

11 Comments
My initial answer moved here
Your script is named cla.m - but cla is also an inbuit function, that is now shadowed from your script. Rename your script and you get rid of this. To make sure check:
which cla -all
There should not occur files you created.
Stephan
on 2 Dec 2020
In R2020a:
>> which cla -all
C:\Program Files\MATLAB\R2020a\toolbox\matlab\graphics\cla.m
C:\Program Files\MATLAB\R2020a\toolbox\matlab\uicomponents\uicomponents\graphics\+matlab\+ui\+control\UIAxes.p % matlab.ui.control.UIAxes method
Wolfgang McCormack
on 2 Dec 2020
John D'Errico
on 2 Dec 2020
Edited: John D'Errico
on 2 Dec 2020
The probem is, that cla.m file you have is in the way. For some reason, you either created the file or perhaps you edited the existing version of cla.m, and deleted what was in there.
You keep seeing this eeror message, because plot uses cla. So everytime you try to plot, it uses cla. And somehow cla got either overwritten, or corrupted, etc.
If the cla on your drive is an empty file, then somehow it got stepped on.
If you do this at the command line,
type cla
this is what I see:
>> type cla
function ret_ax = cla(varargin)
%CLA Clear current axes.
% CLA deletes all children of the current axes with visible handles and resets
% the current axes ColorOrder and LineStyleOrder.
%
% CLA RESET deletes all objects (including ones with hidden handles)
% and also resets all axes properties, except Position and Units, to
% their default values.
%
% CLA(AX) or CLA(AX,'reset') clears the single axes with handle AX.
%
% See also CLF, RESET, HOLD.
% CLA(..., HSAVE) deletes all children except those specified in
% HSAVE.
% Copyright 1984-2020 The MathWorks, Inc.
...
So if that file is indeed empty, then it would perhaps be best and easiest if you just redownload a new copy of MATLAB. This takes a matter of minutes.
If you have a complicated set of directories to set on your search path, I like to use the export_search_path utility I have posted on the file exchange. This allows you to easily export a search path in one release, and then re-create a comparable search path on a new release.
Wolfgang McCormack
on 2 Dec 2020
Stephan
on 2 Dec 2020
I doubt that we can publish TMW's intellectual property here at the forum
Wolfgang McCormack
on 2 Dec 2020
Benjamin Kraus
on 2 Dec 2020
Looks to me like your MATLAB installation is corrupted. You can try reinstalling MATLAB, or contact technical support for assistance. They can certainly send you a copy of cla.m, but I'd be concerned that if cla.m is corrupted, there may be other files in the MATLAB installation that are corrupted.
Wolfgang McCormack
on 20 Dec 2020
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing 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!

