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!