フィルターのクリア

How to zoom into a figure in matlab GUI

4 ビュー (過去 30 日間)
Suki Sandhu
Suki Sandhu 2017 年 1 月 16 日
コメント済み: Suki Sandhu 2017 年 1 月 16 日
I have the following piece of code that does what I want it to. I am having a hard time trying to get it to work for the figure on matlabs guide.
h=gcf;
set(h.Children,'Xlim',[lineLength-100 lineLength+100], 'Ylim',[nextLine-100 nextLine+100]);
How can I edit this/or the figure properties to get it to work?

採用された回答

Image Analyst
Image Analyst 2017 年 1 月 16 日
Instead of h.children, use the actual names of the axes that you have placed on the GUI with GUIDE:
set(handles.axes1, .........);
set(handles.axes2, ...........);
etc.
Set whatever axes properties you want. This is the old way. The new way is to use OOP style
handles.axes1.XLim = [0 10];
or simply use the xlim() function
xlim(handles.axes1, [0, 10]);
  1 件のコメント
Suki Sandhu
Suki Sandhu 2017 年 1 月 16 日
The one and only Image Analyst himself. Thank you good sir. :)

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 1 月 16 日
Inside a callback for the GUI, assuming that you named the first parameter to the function hObject, then
h = findobj( ancestor(hObject, 'figure'), 'type', 'axes' );
set( h, ','Xlim',[lineLength-100 lineLength+100], 'Ylim',[nextLine-100 nextLine+100]);

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by