Clear Filters
Clear Filters

Displaying text in the command window when running a program

581 views (last 30 days)
Am I being really stupid in failing to find how to display text in the command window when running my program?
Ie. I want to just have little sections of text that pop up explaining what is happening in the program-and I want these to be displayed in the command window for a user to see.
I have tried using the disp command, however as the text I am choosing to display has not been assigned to a variable so it will not work.
I guess one way to get around this, albeit messy, it is assign chunks of text to random variables and then choose the disp that variable-although it surely sounds like there is a tidier method.
Thanks in advance,
Mike Scott
  1 Comment
saisanthosh prasen
saisanthosh prasen on 2 Dec 2016
Edited: per isakson on 2 Dec 2016
h = msgbox('Operation Completed'); using command like msgbox also u can get Pop up window...
For more details..

Sign in to comment.

Accepted Answer

Matt Fig
Matt Fig on 12 Apr 2011
What do you want to display? You can use the DISP command without a variable.
disp('At line 50')
Stefanos on 13 Dec 2022
Using that code they are represented ans how can I represent them as one array with all the answers?(One array for an with all the ans and another for bn)?
for i= 1:N
for i= 1:N

Sign in to comment.

More Answers (0)


Find more on Entering Commands in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!