Pass function as an argument to standalone application.
10 次查看(过去 30 天)
显示 更早的评论
Hello guys!
I am very new to matlab so please be understanding:) I work on Linux.
I have a function called testwindow that as an argument requires another function stored in another m-file (configuration file).
I need to make it work as a standalone application (to be able to run on a computer without Matlab installed just MCR - Matlab Compile Runtime). So I installed MCR and used Matlab compiler to packed it into a standalone application:
mcc -m -v -w enable -R -startmsg -R -completemsg testwindow.m
And everything went ok, but when I try to run it and pass the "config" function (below) as argument I receive an error:
piotr@sapphira:~/mlvessel-1.4/src/tests$ ./testwindow driveconfig
Initializing MATLAB Compiler Runtime version 8.1
Attempt to reference field of non-structure array.
Error in testwindow (line 30)
MATLAB:nonStrucReference
When working with scripts not standalone app it works ok. So what I am doing wrong?
testWindow.m and driveConfig are attached the problem seems to be following lines in testWindow:
if (~config.window)
return;
end
Many Thanks for any help!
0 个评论
回答(1 个)
Roja
2014-6-26
The Executable does not accept the function name as an argument but you can try creating a “main” function where you need to store the output of the “driveconfig” function in a parameter “config” and then pass it to the “testwindow” function.
The “main” function:
function main ()
config=driveconfig;
testwindow(config);
end
Use the following command while compiling the “main” function:
>>mcc –mv main.m –a testwindow.m –a driveconfig.m
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!