Illustration of output statements, MATLAB Programming

Illustration of Output statements:

For illustration,

>> disp('Hello')

Hello

>> disp(4^3)

  64

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
Appending data to a data File: A text file once exists; the data can be appended to it. The format is similar as formerly, with the addition of the qualifier -append. For illu


The characteristic properties of an aquifer can be used to calculate groundwater velocities, v groundwater (L/T), according to: where KH (L/T) is the hydraulic conductivit

How to design a FIR filter using ANFIS in MATLAB

Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1–y2| and prints a message whether the two are equal or not. Test your function for

Create a GUI that has A button to bring up a dialog to select a text file and read it in. Plot the x,y values on the GUI Have text entry values, one for each parameter, in which


This problem description is taken from Illingworth and Golosnoy [1]: For physical systems of inhomogeneous composition, di usion is often observed to cause a change of phase, even

Obtain the input - Algorithms: From where does the input come? The two possible choices would be from an external file on a disk, or from the user, who enters the number by ty