简体   繁体   中英

Compiling and calling command window contents in Matlab

I am trying to access the command window contents using the code :

cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;

This works perfectly in MATLAB environment but when I deploy the app as a standalone application through the compiler my GUI shows no contents of the command window.

What files or lines needs to be included so that I can get the command window handle or its property active even in standalone apps ?

Thanks in advance !!

The question, and what you're trying to achieve, don't really make sense.

There is no command window in deployed applications, so attempting to retrieve a handle to it is not going to work.

You mention in a comment that you're trying to do this in order to get the messages generated by the deployed application. By default, when you deploy an application, messages that would have been delivered to the command window are instead displayed at the location from which you launched the application - for example, if you call it from a DOS or UNIX command line, they will display there.

If you're doing something like creating a Windows GUI, and there's nowhere for the messages to display, they will get swallowed up by Windows. In this case the appropriate thing for you to do is to modify your code, replacing the display commands (such as disp , fprintf etc) with commands that display the output within your GUI.

If you need to have behaviour that varies between in-MATLAB and deployed versions, place that code within an if block, using if isdeployed ... else ... end .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM