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
Application: Menu driven Modular Program Numerous longer, more involved programs which have interaction with the user are menu-driven, that means that the program prints a men

Algorithm for appex subfunction: The algorithm for appex subfunction is as shown:  Receives x & n as the input arguments.  Initializes a variable for running sum of t

Illustration of Variable scope: Running this function does not add any of variables to the workspace, as elaborated: >> clear >> who >> disp(mysum([5 9 1]))

Function cellplot - Cell array: The function cellplot place a graphical display of the cell array in a figure Window; though, it is a high-level view and fundamentally just di

Illustration of anonymous functions: Dissimilar functions stored in the M-files, when no argument is passed to an anonymous function, the parentheses should still be in the fu

Reading from a Mat-File: The load function is used to read from various types of files. As with save function, by default the file will be supposed to be a MAT-file, and load

Set Operations: The MATLAB has numerous built-in functions which perform set operations on vectors. These involve intersect, union, setdiff, unique, and setxor. All these func

Replacing, Finding, and separating strings: There are numerous functions which find and replace the strings, or parts of strings, within the other strings and functions which

Function strncmp: The function strncmp compares only the first n characters in the strings and ignores the rest. The initial two arguments are strings to compare, and third ar

Expanding a function: The expand function will multiply out terms, and factor will do the opposite: >> expand((x+2)*(x-1)) ans = x^2 x-2 >> factor(ans)