- https://www.mathworks.com/matlabcentral/answers/459405-how-do-i-display-text-in-command-window-matlab-livescript
- https://www.mathworks.com/matlabcentral/answers/1880397-help-for-live-livescripts-in-command-window
How to output strings to the command window instead of live script?
19 views (last 30 days)
Show older comments
Dear matlab community,
I asked a same question in Japanese(https://jp.mathworks.com/matlabcentral/answers/2127011-?s_tid=prof_contriblnk), but I couldn't get an answer to solve the issue, so I'm asking here.
I am writing a script in live script (.mlx).
When I use the functions in the live script including display/output processes using "disp" or "fprintf" function, many strings are output to the live script, impairing readability.
Is there a way to write some of the outputs to the command window or to another file instead of in the live script? Or is there a way to avoid some of them from being output?
I understand it would be easy to just delete the "disp" and "fprintf" in the function, but since the output is from a function in a distributed toolbox, so I would like to change my live script without modifying the function.
Also, I am adding a minimal script for this issue.
outputtest;
function [] = outputtest()
disp('This is test output.')
end
If it is written in .mlx as above, is it possible to change the output to the command window or another file?
Thank you in advance.
0 Comments
Answers (1)
Shivani
on 14 Jun 2024
From what I understand, there is no functionality in MATLAB that allows printing a statement in LiveScript directly to the Command Window.
This has been discussed in the following MATLAB Answer threads:
However, you can prevent the print or display statement from showing outputs amidst the lines of code by selecting the 'Output on Right' option. This action will print the lines of code in a separate window on the right, thereby maintaining good readability. I've highlighted this option in the screenshot below.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!