MATLAB Answers

Print a statement to the Command Window

11,964 views (last 30 days)
NAVNEET NAYAN
NAVNEET NAYAN on 5 May 2017
Commented: GOPINATHAN PRAKASH about 7 hours ago
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?
  2 Comments
GOPINATHAN PRAKASH
GOPINATHAN PRAKASH 7 minutes ago
Hai navneet nayan,
disp('job done');
disp command is used display the string values.

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!