Function fieldnames - structure functions, MATLAB in Engineering

Function fieldnames - structure functions:

The function fieldnames will return the names of the fields which are contained in the structure variable.

>> pack_fields = fieldnames(package)

pack_fields =

'item_no'

'cost'

'price'

'code'

 

As the name of the fields is of different lengths, the function fieldnames returns a cell array with the names of the fields.

To refer to the elements the curly braces are used, as pack_fields is a cell array.

For illustration, we can refer to the length of one of the strings as shown below:

>> length(pack_fields{2})

ans =

4

Posted Date: 10/20/2012 6:00:56 AM | Location : United States







Related Discussions:- Function fieldnames - structure functions, Assignment Help, Ask Question on Function fieldnames - structure functions, Get Answer, Expert's Help, Function fieldnames - structure functions Discussions

Write discussion on Function fieldnames - structure functions
Your posts are moderated
Related Questions
Example of modular program: In a modular program, there would be one main script which calls three separate functions to complete these tasks: A function to prompt an us

True color matrice: The true color matrices are the other way to represent images. The true color matrices are 3-dimensional matrices. The first two coordinates are the coordi

Illustration of Sorting strings: To sort on the rows rather than second dimension should be specified. >> sort(words,2) ans = Hello Hdowy Hi Gbdeo

Matrix Multiplication: The Matrix multiplication does not mean multiplying term by term; and it is not an array operation. The Matrix multiplication has a very particular mean

Program of passing arguments to functions: This was an illustration of a function which did not receive any input arguments nor did it return any output arguments; it easily a

Built-in colormaps: The MATLAB has numerous built-in colormaps which are named; the reference page on colormap shows them. Calling the function colormap without passing any ar

Illustration of symbolic variable: When, on the other hand, z is a symbolic variable to start with, quotes are not required around the expression, and the words are automatica

A matlab function to calculate filter order

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

Example of Interpolation and extrapolation: The MATLAB has a function to do this, known as polyfit. The function polyfit finds the coefficients of the polynomial of the partic