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
The game of Simpli ed Poker is a simple game by today''s standards. You start o with a standard deck of cards, shue the cards, and then give each player 3 cards. Each card has a

Need help programming in Matlab for airy equations

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

Function Name: voteCounter Inputs (1): - (char) filename of votes Outputs (0): - none Function Description: You use the brand new VoteMaster 3000 to tally up votes in the r

design a rc phase shift oscillator for a particular frequency of oscillation and generate a sinusoidal signal

Write a function called threshold2 (in a file called 'threshold2.m'). The function takes an arbitrary number of input variables. The first input variable, t, is required and is the

convolve the following sequences using tabulation method and verify the same using matrix mmethhod

would you please send the programing code simulation.

can i getting wirless programing in matlab

Mathematical operation: For numerical operands, the use of such operators is clear-cut. For illustration, 3 >> 3 ans = 1 >> 9 ans = 0 Though, in the Wo