Why won't anything plot? 6 errors in 3 lines of code.
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm working on a larger project and it wouldn't plot and gave me a bunch of errors about things that weren't even a part of my code. I tried a simple code to see if it wiuld plot, but I'm getting the same errors. I've closed and reloaded MatLab and it continues to error.
x = [1 2 3 4 5];
y = [1 2 3 4 5];
plot(x,y)
Above is the code to plot and below are the errors.
>> Untitled
Undefined function 'claNotify' for input arguments of type 'matlab.graphics.axis.Axes'.
Error in cla (line 42)
claNotify(ax,extra{:});
Error in newplot>ObserveAxesNextPlot (line 152)
cla(ax, 'reset', hsave);
Error in newplot (line 93)
ax = ObserveAxesNextPlot(ax, hsave);
Error in matlab.graphics.internal.newplotwrapper (line 12)
axReturn = newplot(varargin{:});
Error in Untitled (line 3)
plot(x,y)
I'm running MATLAB R2018b - academic use. Thanks for any suggestions.
Respuestas (7)
Star Strider
el 7 de Feb. de 2019
It’s always worth running these commands:
restoredefaultpath
rehash toolboxcache
from your Command Window (or a script) before you click on the Contact Us link in the upper right corner of this page to ask MathWorks for Technical support. (If you need to do that, run the ver command first.)
3 comentarios
Star Strider
el 7 de Feb. de 2019
Use the Contact Us link to request Technical Support from MathWorks.
Rik
el 1 de Ag. de 2019
Comment posted as flag by Andreas Junge:
I had the same message, after the commands Problem was solved!
Matt Gaidica
el 7 de Feb. de 2019
Try:
open plot
See if plot is a variable or if the project has redefined it.
4 comentarios
Veda Upadhye
el 19 de Feb. de 2019
One possible explanation of this issue could be shadowing of 'plot' or built-in MATLAB functions that are internally used by 'plot'. You can verify this using the below example (for 'plot' and other functions in your error stack trace):
which -all plot
0 comentarios
Abdallah Ghazi Faisal Zaid Alkilani
el 28 de Mzo. de 2020
I had a similar issue and I think the culprit is a function called newplot.m.
newplot.m function has subfunctions inside that were not terminated with 'end'.
I added an 'end' statement for each function inside newplot.m:
- function axReturn = newplot(hsave)
- function fig = ObserveFigureNextPlot(fig, hsave)
- function ax = ObserveAxesNextPlot(ax, hsave)
It has worked so far *fingers crossed*.
You can open the file to edit by typing >> open newplot;
I hope this helps.
1 comentario
Rik
el 28 de Mzo. de 2020
I would be very careful with recommending people to edit internal Matlab functions. Those should not be edited, because you have no way of knowing what functions rely on the function behaving the exact way it does.
Apart from that: a function is allowed not to terminate with an end keyword, as long as non of the functions do so. This used to be the default; Matlab would even warn you about the unnecessary closing end statements.
Nurye Hassen
el 6 de Ag. de 2020
Optionally, you can enter the variables X and Y on the command window, then select them from your workspoace then go to "Plots" tab on the top next to "Home" to choose the plot you need. That may help.
0 comentarios
Nurye Hassen
el 6 de Ag. de 2020
Editada: Nurye Hassen
el 6 de Ag. de 2020
To solve the problem once and for all do the following on command window.
open plot
then right click on the plot file on the editor and select "show in folder" and check the path. For your case it should be where you installed the MATLAB like...
C:\Program Files\MATLAB\R2017b\toolbox\matlab\graph2d
if you got it in Documents or other folder delete all the files or ZIP and keep it far away.
Let me know if didn't solve it.
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!