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
Digging the Dirt: Autonomous Mining Robots   Mining is a multi-billion dollar industry and a critical part of the Australian economy. Much of the day-to-day work on mining sites

Matlab Command Reference 1. Getting Help: The help command is used to find the functions and its syntax. Similarly, lookfor is used to find the functions or topics. For examp

Functions with Local Variables: The functions we have seen faraway have been very easy. Though, in many situations the computations in a function are more complex, and may nee

Solve the optimality condition for each P equation against M according to the following relation: Condition for Optimality:         ∇ M = λ ∇ P      with respect to C and T.

Micro-mouse is an engineering design competition created by IEEE in the late 1970s. Small robotic "mice" solve a 16x16 cell maze. The mice are completely autonomous and must find t

The fundamental theorem of calculus states that the de?nite integral of a function may be found from the antiderivative of the function. However, for many functions, it is much eas

Background Protein therapeutics are a major component of the biotechnology industry, with sales estimated in the range of ~$99bn annually (2011) and steady market growth. Many phar

Read in any non jpeg image (any image will do) . Save it as a jpeg at quality levels (70, 60,50,40, 30) Get the MSE for each quality level as compared to the orignal file Get the

How to simulate a robot

Plot way forms for the following modulation schemes using Matlab: a)      2 ASK                     b)  BFSK                                  c) BPSK          4 ASK