MATLAB Answers

Print a statement to the Command Window

17,693 views (last 30 days)
NAVNEET NAYAN on 5 May 2017
Commented: waleed Al-Qurashi on 16 Feb 2021
I am writing a program. I want to display the statement 'job done' as the output in the Command Window. How can I do it?
  1 Comment
waleed Al-Qurashi
waleed Al-Qurashi on 16 Feb 2021
3)What is the command that writes a message to the screen?

Sign in to comment.

Accepted Answer

KSSV on 5 May 2017
Edited: MathWorks Support Team on 27 Feb 2020
To display text in the Command Window, use disp or fprintf.
disp('job done')
fprintf('job done \n')

More Answers (2)

Gaurav Srivastava
Gaurav Srivastava on 26 May 2019
It's not happening. How to display LHS=RHS?Screenshot (9).png
Steven Lord
Steven Lord on 21 Jun 2019
Even though a and b are displayed the same, that doesn't mean their contents are the same. The == operator checks for exact down-to-the-last-bit equality. In this case, a and b are close but close doesn't count. See this Answers post for an alternative.

Sign in to comment.

Peyton Spainhour
Peyton Spainhour on 29 Oct 2020
for k =1:5
if A<=15
A=A + 3
A = A+2

Community Treasure Hunt

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

Start Hunting!