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

1 回表示 (過去 30 日間)
Elisavet Chatzizyrli
Elisavet Chatzizyrli 2015 年 8 月 25 日
コメント済み: Walter Roberson 2015 年 8 月 26 日
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 Center および File ExchangeGraphics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by