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
Example of Gauss-jordan: For a 2×2 system, this would results and for a 3 × 3 system, Note that the resulting diagonal form does not involve the right-most col

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

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 Graphics properties: A particular property can also be exhibited, for illustration, to view the line width:     >> get(hl,'LineWidth')     ans =

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


Binary Search: The binary search supposes that the vector has been sorted first. The algorithm is just similar to the way it works whenever looking for a name in a phone direc

Print from the structure: To print from the structure, a disp function will show either the whole structure or a field. >> disp(package) item_no: 123 cost: 19.99

Program to Counting in a while loop: The script initializes variable counter to 0. Then, in the while loop action, each and every time the user successfully enter a number, th

Q.1: Consider the transmission of a sinusoid x(t) = cos(2f0t) through a channel a ected by multipath and Doppler. Let there be two paths, and assume the sinusoid is being sent fro