MATLAB: Emailing gui code

guiguide

i designed a GUI using GUIDE and emailed .m file to my friend. but he is not able to view the results
even when i tried to copy and paste the contents of mailed .m file ,i got the following error.
??? Error using ==> load Unable to read file unit5.fig: No such file or directory.
Error in ==> hgload at 43 fileVars = load(filename,'-mat');
Error in ==> openfig at 72 [fig, savedvisible] = hgload(filename, struct('Visible','off'));
Error in ==> gui_mainfcn>local_openfig at 286 gui_hFigure = openfig(name, singleton, visible);
Error in ==> gui_mainfcn at 159 gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
Error in ==> unit5 at 42 gui_mainfcn(gui_State, varargin{:});
is there something else also,that i need to send.??
regards

Best Answer

You need to send unit5.fig as well.
GUIDE generates two files: a .m file and a .fig file. Neither part is meaningful without the other.
There is an option in GUIDE to generate pure .m code that builds the figures and controls at run time. That would result in a single (larger) .m file that could be emailed.
Related Question