Share data between functions in main
2 views (last 30 days)
Show older comments
hi,i've a project that open a sub-gui to input some values and it sendds to main-gui. in main gui i need to use those values in a function that plot the result of simulation. i'm not using guide.the code:
function [] = gui_passdata()
S.fh = figure('units','pixels',...
'position',[20 104 851 596],...
'numbertitle','off',...
'name','Simulação',...
'resize','on');
S.ed = uicontrol('style','text',...
'units','pix',...
'position',[50 414 101 31],...
'string','Temperatura.');
S.pb2 = uicontrol('style','pushbutton',...
'units','pix',...
'position',[549 30 151 31],...
'string','Executar',...
'callback',{@pb2_call,S});
guidata(S.fh,S);
uicontrol(S.ed)
function [] = pb2_call(varargin)
% Callback for GUI_24 pushbutton.
S = guidata(gcbf); % Get the structure.
i want to pass data from gui_passdata to pb2_call but i only find how to share data with GUI
0 Comments
Answers (1)
Fangjun Jiang
on 30 Aug 2011
Well, since you are not using GUI, I think it's easier. You can define the output argument of your function gui_passdata() and pb2_call().
3 Comments
Fangjun Jiang
on 30 Aug 2011
All I am saying is that you are not bounded by the GUI template. You can return any data in any format you like in your function. Maybe give it a good thought first and plan a good data structure.
See Also
Categories
Find more on Predictive Maintenance Toolbox 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!