Using axes in GUI

6 views (last 30 days)
Chethan
Chethan on 12 Apr 2013
My interest is to display image in axes, I've 2 GUI's input_window and fig5. In my former GUI I've used one axes to display image using uigetfile ,
axes(handles.axes1);
imshow(fname);
Now by pressing pushbutton in 1st GUI it switches to fig5 GUI, where I've used so many axes to display multiple images, also i want to display *fname *image in one axes and it should automatically get displayed in fig5 GUI. For this I've used same above codes in Fig5_OpeningFcn
axes(handles.axes1);
imshow(fname);
I'm getting error like Undefined function or variable 'fname'. please help me how to pass variables between GUI's

Answers (1)

Image Analyst
Image Analyst on 12 Apr 2013
Just use one GUI and put all controls on that. It's annoying for the user to have multiple windows that can get overlapped, hidden, misaligned, etc., plus you have the difficulty as a programmer when you need to make variables in one gui seen in the other, separate gui. Why not just avoid all that and have a single GUI?
That said, if you want to ignore my advice, it can be done. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F, which actually also holds for single-GUI apps where different functions need to share variables.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!