What is the best way to transform a function in a guide?

I have a complete and complex function and i would like to turn it in a guide, i want to know what is the best way to do it.

 Accepted Answer

Functions in your GUIDE program can call other m-files no problem. In some function in your guide m-file, at the place where you want to call this other function, just put its name on a line of code and pass it whatever input arguments it needs and accept whatever output arguments it returns to you (if you want or need them). For example, inside a button callback function in your GUIDE program:
[out1, out2] = MyOtherFunction(in1, in2, in3);

More Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 25 Sep 2013
Edited: Azzi Abdelmalek on 25 Sep 2013
The best way is to start learning how to use Matlab Guide (click on the blue link)

2 Comments

maybe i have not chosen the better question to explain me, i want to know if it possible to call a function (made in other m file) on m file generated by guide.

Sign in to comment.

GUIDE is a toolbox to create an M-file and and FIG-file to create a dialog and the corresponding callbacks. You can create equivalent files manually also, see the famous FEX: 41 GUI examples.
Example:
function myGUI
FigH = figure( ...
'Name', 'My GUI', ...
'IntegerHandle', 'off', ...
'WindowStyle', 'normal', ...
'Visible', 'on', ...
'MenuBar', 'none', ...
'NumberTitle', 'off', ...
'Resize', 'off', ...
'Units', 'pixels', ...
'Position', [100, 100, 500, 400], ...
'NextPlot', 'add', ...
'BusyAction', 'cancel', ... % Block new actions during computing
'Color', DlgBG, ...
'Tag', DlgTag, ...
'DeleteFcn', @CloseGUI, ...
'CloseRequestFcn', @CloseGUI);
uicontrol('Style', 'Pushbutton', 'Position', [10, 10, 80, 30], ...
'String', 'close', ...
'Callback', @CloseGUI);
function CloseGUI(ObjectH, EventData)
FigH = ancestor(ObjectH, 'figure');
disp('Closing the figure');
delete(FigH);

Categories

Find more on Interactive Control and Callbacks 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!