Handles in Matlab Guide

7 views (last 30 days)
Amanda
Amanda on 1 Sep 2012
I am having a difficult time understanding use of handles
in MATLAB's guide. WHEN TO USE THEM?
For example, this is MATLAB's example how to use MATLAB Guide:
handles.peaks = peaks(35);
[x, y] = meshgrid(-8:.5:8)
handles.current_data = handles.peaks
surf(handles.current_data)
I guess we are using handles to pass data to the functions.
I'm confused.
Thanks,
Amanda

Accepted Answer

Image Analyst
Image Analyst on 1 Sep 2012
That's correct. That's one of the ways to make an otherwise local variable into a global variable so that they can be seen in other functions. Most of the other ways are discussed here: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F In your case you don't need to do that unless you're going to need those variables later, in a different function or callback function.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!