Created
February 6, 2014 16:47
-
-
Save grandadmiral-thrawn/8848004 to your computer and use it in GitHub Desktop.
This is my function to gather data fro m a listbox and save to workspace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function h_push_listbox_call(h_push_selectws, eventdata, h_list_watersheds) | |
% Callback for pushbutton related to listbox and display box. | |
%% NOTE!! To get this to work you must set up the function inputs as | |
% (the handle to the object you want, eventdata <-- exactly this!!!, and the object you are pulling from) | |
% handle is the object | |
% just put eventdata, always empty | |
% handles is the structure you are getting the information from. you can have multiple ones but don't specify the fields. | |
% The variable 'response' is assigned to the parameter of 'value' for the watershed listbox | |
response = get(h_list_watersheds.list,'value'); | |
% in the command prompt, the response is displayed for our interest | |
disp(h_list_watersheds.lookup{response}); | |
% a dummy variable 'a' is assigned to the response | |
a = (h_list_watersheds.lookup{response}); | |
% the parameter of 'userdata' in h_push_selectws button is assigned to a | |
set(h_push_selectws,'UserData',a); | |
% in the base workspace, a variable named 'selectedwatershed' is given a | |
assignin('base','selectedwatershed',a); | |
uiresume(gcbf); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment