- The startup.m file is always included with the compiled application. This is to ensure that the behavior of MATLAB and the compiled application is same during the initialization phase.
- If you want some statements in the startup.m file to NOT execute when the compiled application is running then, wrap those statements under isdeployed . For your use case, I'd do:
Matlab Compiler Standalone Application and startup.m
7 次查看(过去 30 天)
显示 更早的评论
So I'm trying to use the Matlab Compiler in order to build a standalone application which to run on a separate machine using MCR. The actual application follows this guide to benchmark GPU. When I open matlab following this I make the following command to compile the standalone application:
mcc -mv -o gpuTest mainBench.m benchFcn.m executeBenchmarks.m getData.m paralleldemo_gpu_backslash.m timeSolve.m waitForCpu.m waitForGpu.m
The output is:
Compiler version: 5.1 (R2014a)
Dependency analysis by REQUIREMENTS.
Parsing file "/media/hdd/work/matlab/gpuBench/mainBench.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/benchFcn.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/executeBenchmarks.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/getData.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/paralleldemo_gpu_backslash.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/timeSolve.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/waitForCpu.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/waitForGpu.m"
(Referenced from: "Compiler Command Line").
Parsing file "/opt/MATLAB/R2014a/toolbox/compiler/deploy/deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "/opt/MATLAB/R2014a/toolbox/compiler/deploy/printdlg.m"
(Referenced from: "Compiler Command Line").
Than on the other machine, given that the environmental variables are set I just execute the command
./gpuTest
The resulting error is:
Cannot CD to /media/hdd/work/matlab (Name is nonexistent or not a directory).
Error in startup (line 1)
Problem is there is no "startup" script from in the folder of the scripts that should have been compiled. However I do have a "startup.m" script which is in my startup folder which in fact exactly executes "cd /media/hdd/work/matlab" and some other stuff.
I have 2 questions:
- Why the heck is it compiling also my startup script at all?
- How can I fix this to just execute the main script?
I'm using Matlab R2014a with the corresponding MCR 8.3.
0 个评论
采纳的回答
Harsheel
2015-4-17
if ~isdeployed
cd('/media/hdd/work/matlab')
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standalone Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!