Problem: plot is displayed in the whole gui window instead of in the axes object.

조회 수: 6 (최근 30일)
I have a function that generates a mesh and plots it. I call this function from a push button object. The generated mesh is displayed in the whole gui window, covering it completely, making the gui useless. The only way I partially solved it, was by calling 'figure' before calling the function. The outcome really baffles me. The mesh is plotted in the axes object as expected and then a blank figure is prompted. Please could anyone help?

답변 (1개)

Morteza
Morteza 2015년 8월 25일
편집: Morteza 2015년 8월 25일
it is not a suitable way in GUI programming. just make a handles.axes1 (Axis) in your GUI and whenever you want to plot something special just make this axis as your place that MATLAB plot data.
axes(handles.axes1);
plot('WHATEVER YOU WANT TO PLOT');
  댓글 수: 4
Elisavet Chatzizyrli
Elisavet Chatzizyrli 2015년 8월 26일
The mesh function doesn't use the simple plot function for plotting. It would be simple enough to pass as a first argument the axes handle. For the trisurf function for instance, I did the thing with 'Parent' and then declaring the axes handle, but it still doesn't work. For some reason the mesh is plotted in the axis object, as intended, when I write figure before calling the mesh function from the button callback function, but then a blank figure is prompted as I said in my first post. When I simply declare axes(handles.axes1) in the first line of the code of the mesh generation function, without making any other change in the subsequent code, then an error message saying "Invalid object handle" is prompted when I push the button that calls the mesh generation function. I passed handles as an input in the mesh generation function, does it need something more?
Walter Roberson
Walter Roberson 2015년 8월 26일
Your axes has been deleted along the way, it sounds like.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by