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
Technique is to create one element - vector: Technique is to create one element with the values from one structure, and use repmat to replicate it to the preferred size. Then,

Indexing into Vectors of structures: Frequently, when the data structure is a vector of structures, it is essential to iterate through the vector in order by various fields. F

readlenwid function: function call: [length, width] = readlenwid; function header: function [l,w] = readlenwid In the function call, not any argument is passed; henc

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


Converting between the String and Number types: The MATLAB has many functions which convert numbers to strings in which each character element is a separate digit, and vice ve

Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Creating Cell arrays: There are many ways to create cell arrays. For illustration, we will create a cell array in which one element will store an integer, one element store ch

Displaying expressions: The good-looking function will show such expressions by using exponents; for illustration, >> b = sym('x^2') b = x^2 >> pretty(b)

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