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
Gauss-Jordan: The Gauss-Jordan elimination technique begins in similar way which the Gauss elimination technique does, but then rather than of back-substitution, the eliminati

Illustration of Sound files: For illustration, the following script generates a subplot which shows the signals from chirp and from train, which is as shown in figure:

Forward substitution: The Forward substitution (done methodically by first getting a 0 in the a 21 place, and then a 31 , and lastly a 32 ): For the Gauss technique,

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

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

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

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

Example of Exponential function modular program: In order to view the distinction in the approximate value for e as n increases, the user kept choosing Limit & entering larger

Illustration of gauss-jordan: Here's an illustration of performing such substitutions by using MATLAB >> a = [1 3 0; 2 1 3; 4 2 3] a = 1 3 0 2 1 3 4 2

Function rmfield - structure: The function rmfield eliminates a field from the structure. It returns a new structure with field eliminated, but does not modify the original st