How can I make correct executable file?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I made an executable file from my code below.
mcc -m test_yli.m
My code:
#
function b = test_yli(a)
if ischar(a)
a = str2num(a);
end
b=a+1;
disp(b)
disp('code stop here')
Then I run
#
[status result] = system('"test_yli.exe" "1"')
But the returned value are
status =
0
result =
2
code stop here
But I simply want to get the returned b=2. If I delete the two disp() command in my -m code for making the executable file, then my returned value (e.g. retult) is empty!
status =
0
result =
''
Can anyone please tell me where I'm wrong? Many thanks in advance!
0 件のコメント
回答 (1 件)
Steven Lord
2018 年 6 月 25 日
0 投票
From the "Using a MATLAB File You Plan to Deploy" section on this documentation page: "You cannot return values from your standalone application to the user. The only way to return values from compiled code is to either display it on the screen or store it in a file."
Remember, MATLAB isn't running your application. Your operating system is, and your operating system has no notion of how a MATLAB variable should be stored in memory if it were to be returned from your application.
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!