Why nothing is being plotted and this code is being appeared constantly? (Attempt to execute SCRIPT cla as a function:)

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.
Wolfgangs comment moved here:
Hi Stephan,
Thank you for your prompt reply. So, nothing is named cla.m I guess. I am posting a screenshot. And it appears in all of my MATLAB files.
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
Thanks, but I installed it to F although the Graphics exist in the folder and cla.m is avialable. However, cla is 0 kb!
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.
OK so the Type cla doesn't show anything for me. Is it just possible to get the content of cla from you guys and copy and paste the cla there only? cause everything else is working great!
I doubt that we can publish TMW's intellectual property here at the forum
Oh, right, it's part of the software, I just thought it's a code
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.
How can I pick stephan's answer as the correct one? it solved my problem

Sign in to comment.

 Accepted Answer

John D'Errico's and Stephan's answers were both correct. The cla.m was empty.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!