Matlab 2017b plotting error.

18 次查看(过去 30 天)
I can't plot anything. My error is:
No appropriate method, property, or field 'Type' for class 'matlab.graphics.GraphicsPlaceholder'.
Error in newplot>ObserveAxesNextPlot (line 134)
if ~strcmp(fig.Type,'figure')
Error in newplot (line 89)
ax = ObserveAxesNextPlot(ax, hsave);
Error in blabla (line 11)
plot(x,e);
Help me, please.
  4 个评论
Jan
Jan 2018-1-13
@Catalin: Please use the "{} Code" button to format code. This is nicer than inserting blank lines.
Star Strider
Star Strider 2018-1-13
Your code, as you posted it, runs without error for me in R2017b.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2018-1-13
This is not the expected behavior. It is strange, that the parent of the axes is a matlab.graphics.GraphicsPlaceholder and not a figure or uipanel. This should never happen. So I ask the standard questions:
  • Did it work any time before?
  • What did you change since it worked?
  • Did you shadow any built-in functions, e.g. figure, axes etc.? If so, don't do this. Add folders with user defined function at the bottom of the path only, never on top where they can shadow built-in function and cause a strange behavior.
  • Is this a fresh install of Matlab? Which version and which OS?
  5 个评论
Jan
Jan 2018-2-8
I assume, this is caused by a user-defined function, which shadows a built-in function. Check this by removing all folders containing user-defined code from the path. Then test it again. Does it run now?
If so, re-insert the user folders and check for conflicts: FEX: UniqueFuncName.
If there are conflicts, rename the user-defined function or move them into a package.
Andrea Gargano
Andrea Gargano 2018-7-8
编辑:Andrea Gargano 2018-7-8
I've had the same error today. I imported some .csv file in matlab through the import data tool. I created two importfile functions with different name and used the stem function to plot it but the error message occured. I do not understand what is wrong and how to fix it.

请先登录,再进行评论。

更多回答(3 个)

Felix Bernreuther
Felix Bernreuther 2018-3-18
I've had the same Problem.
Solution (Linux): If you're using Linux open Matlab by typing "matlab -softwareopengl" in the shell.
Notice:
"matlab" -> no Plot is possible Error : "if ~strcmp(fig.Type,'figure')[...]"
"matlab -softwareopengl" -> plotting possible without any errors.
If there is some Expert who knows what's this about I'd like to hear his explanation.
  2 个评论
Kurt
Kurt 2018-3-25
编辑:Kurt 2018-3-26
% If you want to save that, try following command.
>> opengl('save','software');
mn
mn 2018-4-4
I just had this problem after fresh installation of 2018a on Ubuntu 14.04, and this worked. I'd be curious to hear that expert's explanation, too.

请先登录,再进行评论。


Sze Yu Chan
Sze Yu Chan 2018-2-8
I also have the same problem using 2017b and Windows 10.
  2 个评论
Jan
Jan 2018-2-8
Please post the details: Did it work before you have changed anything? If so, what has been changed? Did you exclude that a user-defined function shadows a built-in function? Remove all user-defined folders from the path and run the code again.
Did the code run successfully under a Matlab version < R2014b, when the graphics engine has been saved?
I guess, that it would take some minutes only to find the reason using the debugger. But I do not have access to your or Catalin's computer. Therefore you have to use the debugger by your own, or provide as many details as possible in the hope, that some useful information are contained also. "I have the same problem" does not allow to help you and it does not support the OP.
Sze Yu Chan
Sze Yu Chan 2018-2-9
I have used MATLAB for the first time. I just installed 2017b and haven't changed anything. I tried to use debugger and had the same result as the asker's. I tried other functions that draw graphics like bar(), and still reported error. Thus I uninstall 2017b and install 2016b. Now it works.

请先登录,再进行评论。


Steven Lord
Steven Lord 2018-2-8
My suspicion is that somehow the variable x has become a matlab.graphics.GraphicsPlaceholder. The error message you posted occurs on line 11 of your code, but your plot call is on line 7 of the code you posted. What's in the four lines you left out? Did you perhaps use findobj or findall on one of those four lines, assigning the output of that call to x?

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by