Function rmfield - structure, MATLAB in Engineering

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 structure (except the returned structure is assigned to that variable). For illustration, the below would eliminate the code field from the newpack structure, however store the resulting structure in the default variable ans. The value of the newpack remains unaffected.

>> rmfield(newpack, 'code')

ans =

item_no: 111

cost: 19.9900

price: 34.9500

>> newpack

newpack =

item_no: 111

cost: 19.9000

price: 34.9500

code: 'g'

 

To change the value of newpack, the structure which results from calling rmfield should be assigned to newpack.

>> newpack = rmfield(newpack, 'code')

newpack =

item_no: 111

cost: 19.9000

price: 34.9500

Posted Date: 10/20/2012 5:57:48 AM | Location : United States







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

Write discussion on Function rmfield - structure
Your posts are moderated
Related Questions
Patch function - graphics objects: The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its verti

Passing arguments to functions: In all these functions examples faraway, at least one of the arguments was passed in the function call to be the value(s) of the equivalent inp

Algorithm for the function e: The algorithm for the function eoption is as shown: Use the menu function to show the 4 choices. Error-check (an error would take place

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

Technique to creating this structure: An alternative technique of creating this structure, that is not as efficient, includes using the dot operator to refer to fields in the

Vectors of Structures: In numerous applications, involving database applications, information generally would be stored in the vector of structures, instead of in individual s


Tracing of Square matrices: The trace of a square matrix is the addition of all the elements on the diagonal. For illustration, for the preceding matrix it is 1 + 6 + 11 + 16,

Creating a cell array: The other method of creating a cell array is easy to assign values to particular array elements and build it up element by element. Though, as explained

Illustration of Preallocating a Vector: Illustration of calling the function: >> myveccumsum([5 9 4]) ans =     5  14  18 At the first time in the loop, outvec wil