MATLAB: Problem with displaying output of executable

command linedisplayexecutableoutput

I have a function which produces a string output:
out = myfunction(arg1, arg2)
The last line of the function is disp(out).
I used the deploytool to produce an executable (for Windows). However, when I call myfunction arg1 arg2 in cmd, I do not see any output.
I know the function is working correctly because if I replace disp by writing to a file, that works.
Also what is strange is that if I replace disp() by error(), I do see the error message.
Has anybody had this problem?

Best Answer

If you're compiling it as a 'Windows Standalone Application' switch that to a 'Console Standalone Application'.