필터 지우기
필터 지우기

How can I use input() in a standalone Executable?

조회 수: 6 (최근 30일)
Christof
Christof 2012년 10월 12일
Hi,
does anyone has experience with the input() function in a standalone executable under windows 7 64 bit. i make a example to show my problem
function test
if isdeployed
disp(isdeployed)
end
inp=input('EIngabe','s');
disp(inp)
end
If i compile this function with the deploytool and run it under windows the program stops because of the unknown variable "Eingabe". I think the command shell interprets the input as a new variable, that is unknown. Could anyone give me an advice, how to do user input while the exe is running?
thanks a lot.
Christof

답변 (2개)

Arthur
Arthur 2012년 10월 12일
I guess this is because input needs the command window. Loren explained how input behaves in deployed programs. http://blogs.mathworks.com/loren/2008/09/17/managing-non-deployable-functions-in-a-compiled-application/
It's probably best to use an inputdlg instead.

Christof
Christof 2012년 10월 12일
Hi Arthur,
thanks for your advice to use inputdlg. That works very good. If i use the command window (start through cmd) an run the test-application it works to. Now i make a more complicatet example (please see below)
function test
if isdeployed
disp(isdeployed)
end
test1=input('EIngabe: ','s');
data=rand(10,1).*rand(10,1);
if strcmp(test1,'j')
h=figure;
plot(data)
end
end
After compilation and running in the command window i never go in the if structure. The error tells me, that 'j' is an unknown command. Why does the command window interprets the output from input() as an command?
Kind regards Christof

카테고리

Help CenterFile Exchange에서 Standalone Applications에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by