fail to link the callback function after compiler

2 Ansichten (letzte 30 Tage)
Fan Sudi
Fan Sudi am 2 Apr. 2012
Hello ,I am so sorry I got a problem.My system is win7-64&Matlab2012a. Serval weeks can't solve it.After compiler success,none errors display in the command window.But when I run the exe,it said "undefined the function or ariable 'Diff_callback', when calculating uimenu error" ,How can I set the matlab? The M-function have no errors when running,and every GUI open success,but exe can't.Now Matlab 6.5 like so that too. note:I use mcc function to complier my M.

Akzeptierte Antwort

Fan Sudi
Fan Sudi am 2 Apr. 2012
Hi Titus Once I used the command 'mcc -B sglcpp M' to complier a exe and 'mcc -x M' to a dll in matlab6.5.Now in new version,commands ware changed so that didn't get a good way to complier. Deploytool was unknown for me.Today I had a try,command line is suit for me I think.Thanks for your %#function,I get it.Next,I will go on hunting for a good way to make the command unlink its callbacks to complier a start exe.
  1 Kommentar
Titus Edelhofer
Titus Edelhofer am 2 Apr. 2012
Hi Fan,
your welcome. The last "hunt" I don't understand. Nevertheless, I guess the question is now answered?
Titus

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (5)

Walter Roberson
Walter Roberson am 2 Apr. 2012

Fan Sudi
Fan Sudi am 2 Apr. 2012
function varargout = FMath(varargin) if nargin == 0 OldHandle = findobj('Style','figure','Tag','FMath'); if ishandle(OldHandle) close(OldHandle); end FMathHandle = figure ; set(FMathHandle,'Tag','FMath','Units','pixel','menubar','none','NumberTitle','off',... 'name','FMath计算器V 1.0','Resize','off','Visible','off','Position',[50 100 397 500]);%1120 755 397
generate_figure(FMathHandle);
%movegui(FMathHandle,'center');
set(gcf,'Visible','on');
elseif ischar(varargin{1})%&~isnumeric(varargin{end})
try
if (nargout)
[varargout{1:nargout}] = feval(varargin{:});
else
feval(varargin{:});
end
catch
disp(lasterror);
end
end
%--------------------------------------------------------------------------
function generate_figure(FMathHandle)
Maybe I have many many callback functions so that it is may not to add that for each one.After All,varargin is only a invisibility function.Once I used it in Matlab6.5,there's no this problem.serval months ago,I used 6.5,everything is fine.

Titus Edelhofer
Titus Edelhofer am 2 Apr. 2012
Hi Fan,
is Diff_callback in another file, i.e., Diff_callback.m? In this case you have to either follow Walter's advice or add Diff_callback.m (and the others) to your project file.
If Diff_callback is a subfunction that error should not happen ...
Titus

Fan Sudi
Fan Sudi am 2 Apr. 2012
Hi,Titus, thanks for your help. First when I complier my progect,they're in many files with setting the Path & save it in the matlab menu ,but failure.And then I copy them in one file,after that fail too.My main M function is FMath.m,with many menu labels calling the others.Diff_callback.m is one of them.I tried the method with %#function,it work,and success.It's very useful,supposed,I have many functions,it's impossible to do that add callbacks behind %#function.I didn't worried in Matlab6.5,but in 2012a....er,the other problem I forgot,I complier them but only make one exe with all the M functions in.May I complie the start function without linking the others,like a exe call the other dll.

Titus Edelhofer
Titus Edelhofer am 2 Apr. 2012
Hi Fan,
do you use command line or deploytool? For both you can add an entire folder during compilation: command line would be
mcc -m FMath -a folderWithAllMFiles
or, if you use the deploytool: click on the lower part on "add files/directories" and add the folder containing all m files to the project. For both ways you don't have to specify individual files but folders containing (possibly) many files.
Titus

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by