MATLAB outputting a response

Im new to MATLAB, still getting around the basic commands. Say you have the below, and I want to output the Matrix A or output the value of Q1. Or any other variable. Something like C++ cout of javas System.out.println functions.

%Krylov example

% state space
A=[-3 1 0 0;1 -3 1 0;0 1 -3 1; 0 0 1 -2];
B=[1;0;0;0];
C=[1 0 0 0];

% matching moments at infinity
Q1=B/norm(B);
bhessionAsked:
Who is Participating?
 
yuk99Connect With a Mentor Commented:
If you omit the semicolon (;) from the end, the output will be on the screen. You can just type the variable name and hit Enter.

Another way is DISP function. Type disp(A) or disp(Q1).

For more sophisticated output you can use SPRINTF function:
disp(sprintf('Q1 value is %d\n', Q1))

For more information see SPRINTF doc:
http://www.mathworks.com/help/techdoc/ref/sprintf.html
0
 
bhessionAuthor Commented:
Thanks, perfect answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.