From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output to matlab client wiindow

Hello!
Does anybody know how to output in the Matlab command window?
Matlab code:
disp('Hallo.......')

does not appear in the client window but is a well known Matlab command for outputing.

Thanks for helping

Andi
0 Kudos
Message 1 of 12
(4,753 Views)
When I do it, it does appear in my Matlab command window. Not sure why it doesn't work for you. Do you get an error when you attempt

disp('Hallo.......')

in the command window?
Randall Pursley
0 Kudos
Message 2 of 12
(4,753 Views)
I think he means using the disp command in the Matlab script node in LabVIEW, from which it does not work for me either. Actually, something that bothers me even more than not being able to display messages, is that the Matlab script node does not return errors for simple things for which it should return errors, like using a variable which has not been declared. Does any body know how to configure this so that you do get the errors back?
0 Kudos
Message 3 of 12
(4,753 Views)
Hi Alejandro
The script node has an error in and out. If you do not declare a variable, the error contains this information. Also you hear a beep from matlab.

Outputing to the command window ist still not working, maybe you have an idea?

Saludo
Andi
0 Kudos
Message 4 of 12
(4,753 Views)
I don't think the code you write is actually running through the visible command window. The command window opens up automatically when executed but the code you write enters Matlab through Active X or something so it's execution is not visible. The command window is just another access point into Matlab which means there might be a way to have results display in that window, but it would be more complicated than using the disp function.
Randall Pursley
0 Kudos
Message 5 of 12
(4,753 Views)
I use the disp('Hallo......') command in an m-file that I call from inside LabView's Matlab script node. Is there no way to output to the Matlab command window using the matlab script node in LabView?
0 Kudos
Message 6 of 12
(4,753 Views)
I don't think so. Would it serve the same purpose if you output the data you are displaying using the disp command to a variable and display the data in your LabVIEW program?
Randall Pursley
0 Kudos
Message 7 of 12
(4,753 Views)

I am not able to use sprintf(), fprintf(), or disp() commands in the MATLAB command window, however there is an undocumented feature (or a bug) that allows the input() command to display to the MATLAB command window, _only_ once one input has been accept (for which there was no prompt). In other words, if you have a program with two calls to the input() command (from inside LabVIEW's MATLAB Scripting Node), the _first_ call to input() will show no output, but it will wait for your input at the MATLAB command window. After you enter something, the _second_ call to input() will display its message. All subsequent calls to input() will also display their prompt.

 

The attached code demonstrates the above. This bug in the MathScript node has two features in my mind: 1) it allows the user to enter information at the MATLAB command window, and 2) if you are content to hit "enter" every time, it will print debug messages to the MATLAB window.

 

A possible alternate workaround is to have MATLAB pop up a figure window, which you can than print text to, or put buttons or string/number inputs on.

0 Kudos
Message 8 of 12
(4,326 Views)

The code in the above attachment only appears to run in my LabVIEW 2009 with MATLAB 2009a computer. I tried it today on a LabVIEW 2009 SP1 machine with a newer version (I'm not sure which) version of LabVIEW with no success. Sorry for any false hopes!

0 Kudos
Message 9 of 12
(4,296 Views)

It would be nice to have this capability for debugging but I haven't found a work around either.

0 Kudos
Message 10 of 12
(3,856 Views)