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
A. Introduction The project consists of two parts. In the first part you are asked to perform some preliminary calculation and plotting, and to write the introduction for your

String Manipulation: The string in MATLAB software consists of any number of characters and is contained in the single quotes. Actually, strings are considered as vectors in w

Given , provide solutions for the following systems of equations a) , 1.0 10.5 0.5 9 0.5 3.25 5.25 2.5 2 13 5 6 ? ? ? ? ? ? ? ? ? ? ? A ? ? ? ? ? ? ? ? ? ? ? ? 3 7 16 b b) , 1.0 10

Ant Colony Optimization for Optimization of Route path taken Ant Colony Algorithm is a potential candidate for coupled, 3D optimisation. Ant Colony Algorithm enjoys the overall

A 12-point sequence is x (n) defined as x(n) = { 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1}. Write MATLAB programs to (a) Determine the DFT X (k) of x(n) and plot (using stem function)

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

Scripts to Produce and Customize the Simple Plots: The MATLAB has many graphing capabilities. In most cases, customizing plots are desired and this is the simplest to accompli

This assignment deals with the combination of dynamic memory allocation and structures to create a common data structure known as a doubly-linked list, which is shown in Figure 1.

We wish to numerically perform the following integration: (a) Use Matlab's quad function to perform the above integral. (b) Analytically evaluate the integral (e.g. do t

Design and implement Binary digital modulation for a specific input signal frequency, sampling frequency and signal level for binary frequency shift keying (BFSK) by applying MATLA