MATLAB Answers

Print a statement to the Command Window

15,417 views (last 30 days)
NAVNEET NAYAN
NAVNEET NAYAN on 5 May 2017
Commented: sidway on 13 Aug 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?
  2 Comments
GOPINATHAN PRAKASH
GOPINATHAN PRAKASH on 20 Jun 2021
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
  3 Comments
sidway
sidway on 13 Aug 2021
Try to make a diference between a and b with a tolerance
tol = 1e-3
if abs(a - b) < tol
disp('LHS=RHS')
end

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!