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
Modular programs: In a modular program, the answer is broken down into modules, and each is executed as a function. The script is usually known as the main program. In orde

I have a vector of X, one for Y , one for x-direction velocity U and one for y-direction velocity V. they are at same size. How can I plot streamline of that flow? I follow all exa

Interchange rows : for illustration interchanging rows ri and rj is written as

Vector operations: As vectors are special cases of matrices, the matrix operations elaborated (addition, subtraction, multiplication, scalar multiplication, transpose) work on

Uses of Function handles: The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, th

Example Exit modular program: In the illustration below, the user  Chose the Limit; -   Whenever prompted for n, entered the two invalid values before finally ente

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

Function fieldnames - structure functions: The function fieldnames will return the names of the fields which are contained in the structure variable. >> pack_fields = fiel

Algorithm for the function explaine: The algorithm for the function explaine is as shown:  Print a description of e, the exp function, and how to find the approximate va

IS Functions for Strings: There are many functions for strings, that return logical true or false. The function isletter returns the logical true when the character is a lette