Printing - matrices, MATLAB Programming

Printing - matrices:

For matrices, the MATLAB unwinds the matrix column by column. For illustration, consider the random 2 × 3 matrix as shown below:

>> mat = randint(2,3,[1,10])

mat =

5  9  8

4  1  10

Identifying one conversion character and then the newline character will print the elements from the matrix in one column. The initial values printed are from the initial column, then the second column, and so forth.

>> fprintf('%d\n', mat)

5

4

9

1

8

10

If three of the %d conversion characters are specified, then the fprintf will print three numbers across on each line of output, but again the matrix is unwind column by column. It again prints first the two numbers from the initial column, and then the first value from the second column, and so forth.

>> fprintf('%d %d %d\n', mat)

5  4  9

1  8  10

If the transpose of the matrix is printed, though, using the three %d conversion characters, the matrix are printed as it appears whenever created.

>> fprintf('%d %d %d\n', mat') % Note the transpose

5  9  8

4  1  10

Posted Date: 10/18/2012 5:54:44 AM | Location : United States







Related Discussions:- Printing - matrices, Assignment Help, Ask Question on Printing - matrices, Get Answer, Expert's Help, Printing - matrices Discussions

Write discussion on Printing - matrices
Your posts are moderated
Related Questions
Creating Column Vectors: One way to generate a column vector is by explicitly putting the values in square brackets, separated by the semicolons: >> c = [1; 2; 3; 4] c =

1.      Write a MATLAB program to generate and plot the signal                                     x1(n) = [3 2 -2 0 7],  n = 0,1,2,3,4. 2.      Write a MATLAB program to gen

plase help me to convert a theory part of ammonia-vapour simple absorption system into matlab programmong

Introduction to Matlab: The MATLAB is a graphical and mathematical software package; it has graphical, numerical and programming capabilities. It has built-in functions to do

1) Identify an equation that describes some chemical process.  Your equation should have at least two parameters, at least one of which should contribute in a non-linear way. He

A filter described by the equation:    y(n) = x(n) + x(n-1) + 0.9 y(n-1) - 0.81 y(n-2) (a) Find the transfer function H(z) for the filter and find the poles and zeros of the fil

Creating row Vectors: There are many ways to generate row vector variables. The most important way is to put the values which you want in the vector in square brackets, separa

Illustration of Modifying Elements: Illustration, the fifth element in the vector newvec is 9 >> newvec(5) ans = 9 The subset of a vector, that would be a vector it

How to Open Simpower: 1. Open MATLAB 2. In the "Command Window" write ' simulink ' and press Enter or click on the Simulink icon. 3. Simulink Library Browser w

Calculate the gray level value for all the pixels, Computer Graphics An 8x8 image f[i,j] has gray levels given by the following equation: f [i , j]= ? i-j ? ; i,j=0,1,2,3,4,5,6,7.