Illustration of output statements, MATLAB Programming

Illustration of Output statements:

For illustration,

>> disp('Hello')


>> disp(4^3)


The formatted output can be printed to the screen by using the fprintf function. For illustration,

>> fprintf('The value is %d, for sure!\n',4^3)

The value is 64, for sure!

To the fprintf function, first a string (known as the format string) is passed, that holds any text to be printed as well as formatting information for the expressions to be printed. In this illustration, the %d is an illustration of format information. The %d is sometimes known as placeholder; it identifies where the value of the expression which is after the string is to be printed. The character in the placeholder is termed as the conversion character, and it identifies the kind of value which is being printed. There are many others, but what follows is a list of the simple placeholders:

%d integers (it really stands for decimal integer)

%f floats

%c single characters

%s strings

Do not confuse the % in the placeholder with the symbol used to designate a comment.

The character '\n' at the end of the string is a special character known as the new-line character; whenever it printed the output moves down to the next line.

Posted Date: 10/18/2012 5:50:25 AM | Location : United States

Related Discussions:- Illustration of output statements, Assignment Help, Ask Question on Illustration of output statements, Get Answer, Expert's Help, Illustration of output statements Discussions

Write discussion on Illustration of output statements
Your posts are moderated
Related Questions
This assignment is designed to compare performance between Matlab and Excel for performing nonlinear regression analysis of a set of data. There are two data sets in the accompa

Function char: The function char does the opposite; it converts from any number type to the type char: >> char(numequiv) ans = a As the letters of the alphabet are

Show the output - algorithms: Where does the output go? The two possibilities are (i) to an external file, or (ii) to a window on the screen. Based on system, one of these wil

i want the MATLAB code for properties of refrigerant R134a, Pentane and VCR Refrigeration cycle. Thanks

Diary Files: Before doing this assignment, please read the document Notes on Matlab Assignments (available from the course web page). It describes how to record the results of your

Ft. Loudoun and Watts Bar are two large hydroelectric dams, the former upstream of the latter. The level of Watts Bar Lake must be kept within limits for recreational purposes, and

to find given number is odd or even in an array with explanation and flow chart

Problem 1.  Use Matlab to solve the following system of linear equations: 2x + y + 3z = 1 2x + 6y + 8z = 3 6x + 8y + 18z = 5 Capture Matlab code and the result in a text fi