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

Define a function: The radius of a circle is passed to the function to input argument  rad; the function computes the area of this circle and stores it in the output argument

Strings: The MATLAB also handles strings that are a sequence of characters in single quotes. For illustration, using the double function on a string will represent the equival

write a matlab program to calculate employee salary.

In MATLAB, create a correlation matrix for all of the variables in the data (it should be an 8x8 matrix). To do this you will have to convert the "southern"variable into a number.

1. Design a suitable phase-lead controller. You should explain in detail how your design has been developed. Your solution should include Bode plots constructed both manually and


Matrices of random numbers: The Matrices of random numbers can be generated using the rand and randint functions. The first two arguments in the randint function identify the

You will need to implement at least two Matlab functions: HW3main.m and svmTrain.m. The implementation details are as follows: function [alpha] = svmTrain(X,T,kernel,C,sigma) %

The Requirement details of project are as below. I also need detail description for presentation. For the project, given the training dataset ticdata2000.txt use any method you