MATLAB Answers

Print a statement to the Command Window

18,476 views (last 30 days)
NAVNEET NAYAN
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
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')
or
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
  2 Comments
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
A=6
for k =1:5
if A<=15
A=A + 3
else
A = A+2
end
end
A

Community Treasure Hunt

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

Start Hunting!