script runs fine in matlab environment but fails to run when compiled

5 次查看(过去 30 天)
I have a script that runs perfectly in the matlab environment but does not work when compiled as a stand alone program. Matlab does not throw up an error or anything the program just stops working and closes about half way through completion. I checked mccExcludedfiles.log and it didn't have anything in it. I am using the signal processing toolbox and it is checked under settings toolbox on path. I am unclear as to whether or not matlab can compile a script or if it has to be a function. I have R2012a. How can I figure out where the program is hanging up and why?

回答(2 个)

Walter Roberson
Walter Roberson 2012-8-7
In all previous releases, scripts could not be compiled (only functions.) I have not seen any indication that that has changed, but I have not read the release notes.

Matthew
Matthew 2012-8-7
编辑:Walter Roberson 2012-8-8
After reading the documentation more carefully it looks like matlab can compile a script, but it can't be the top layer. There must be a function that calls the script. By changing my script to a function I was able to make it work. The mccExcludedfiles log now has a list of functions in it. The stand alone appears to work correctly, so now I'm wondering why there is so much stuff listed in the excluded files. It looks like all of it is from the signal processing toolbox.
Here is what a portion of the file looks like.
C:\Program Files\MATLAB\R2012a\toolbox\signal\sigtools\fvtool.m
called by C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\@fdesign\@abstracttype\privdesigngateway.m
(because of toolbox compilability rules)
C:\Program Files\MATLAB\R2012a\toolbox\signal\sigtools\fvtool.m
called by C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\@fdesign\@abstracttype\superdesign.m
(because of toolbox compilability rules)
C:\Program Files\MATLAB\R2012a\toolbox\signal\sigtools\wintool.m
called by C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\window.m
(because of toolbox compilability rules)
C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\@dfilt\@basefilter\isscalar.m
called by C:\Program Files\MATLAB\R2012a\toolbox\matlab\polyfun\interp1.m
(C:\Program Files\MATLAB\R2012a\toolbox\compiler\depfun.opts, line 7:
exclude if $caller in [$toolbox/matlab, $toolbox/daq] and ...
$file in $toolbox and ...
$file not in [$toolbox/matlab, $toolbox/shared, $toolbox/compiler] ...
and not ($file in $toolbox/distcomp and $caller in $toolbox/matlab))
C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\@dfilt\@basefilter\isscalar.m
called by C:\Program Files\MATLAB\R2012a\toolbox\matlab\uitools\waitbar.m
(C:\Program Files\MATLAB\R2012a\toolbox\compiler\depfun.opts, line 7:
exclude if $caller in [$toolbox/matlab, $toolbox/daq] and ...
$file in $toolbox and ...
$file not in [$toolbox/matlab, $toolbox/shared, $toolbox/compiler] ...
and not ($file in $toolbox/distcomp and $caller in $toolbox/matlab))

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by