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!