Print from the structure, MATLAB in Engineering

Print from the structure:

To print from the structure, a disp function will show either the whole structure or a field.

>> disp(package)

item_no: 123

cost: 19.9900

price: 39.9500

code: 'g'

>> disp(package.cost)

19.9900

Though, using fprintf, only the individual fields can be printed; the whole structure cannot be printed.

>> fprintf('%d %c\n', package.item_no, package.code)

123  g

Posted Date: 10/20/2012 5:57:03 AM | Location : United States







Related Discussions:- Print from the structure, Assignment Help, Ask Question on Print from the structure, Get Answer, Expert's Help, Print from the structure Discussions

Write discussion on Print from the structure
Your posts are moderated
Related Questions
Example of image processing: The other illustration generates a 5 × 5 matrix of arbitrary integers in the range from 1 to the number of colors; the resultant image is as shown

Replacing a string - function strrep: The function strrep finds all the occurrences of a substring within the string, and substitutes them with a new substring. The order of a

Example of file ploting data: As the other example, a data file called 'compsales.dat' stores the sales figures (in millions) for divisions in a company. Each line in the f

Solving 2 × 2 systems of equations: However this may be easy in a MATLAB, in normal finding solutions to the systems of equations is not. The systems which are 2 × 2 are, thou

Finding a sting - function strfind: The function strfind does necessarily similar thing, except that the order of the arguments does make dissimilarity. The common form is str

Examine exponential function: The algorithm for the main script program is shown below:  Call a function eoption to show the menu and return the user's choice.  Loop

Interpolation and extrapolation: In most cases, it is desired to estimate values other than at the sampled data points. For illustration, we may want to estimate what the temp

deblank function: The deblank function eliminates only trailing blanks from the string, not leading the blanks. The strtrim function will eliminate both the leading and traili

Illustration of if - else statement: The one application of an if-else statement is to check for errors in the inputs to a script. For illustration, a former script prompted t

Text graphic function - Graphics objects: The text graphic function permits text to be printed in a Figure Window, involving special characters which are printed by using \spe