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 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


Finding a sting - function findstr: The function findstr receives two strings as input arguments. It finds all the occurrences of shorter string contained by the longer, and r

Illustration of finding a sting: Let's enlarge this, and write a script which creates a vector of strings which are phrases. The outcome is not suppressed so that the string

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

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

function imread: The function imread can read an image file, for illustration a JPEG (.jpg) file. The function reads color images into a 3-dimensional matrix. >> myimage1

Forward elimination: In forward elimination, we want to obtain a 0 in the a 21 position. To accomplish this, we can alter the second line in the matrix by subtracting from it

Illustration of Gauss elimination: For illustration, for a 2 × 2 system, an augmented matrix be: Then, the EROs is applied to obtain the augmented matrix into an upper

Illustration of gauss-jordan elimination: An illustration of interchanging rows would be r1 ¬→ r3, that would results: Now, beginning with this matrix, an illustration of sc