imat_shp/set


Purpose

Set one or more attributes of an imat_shp object.

Syntax

set(s)
s1=set(s,'attrib1',value1,'attrib2',value2,...)
s(1:2)=set(s(1:2),'attrib1',value1,...)
s1=set(s,v)

Description

The SET function allows you to change any attribute of an imat_shp variable.

If SET is called with no attribute arguments, then all attribute names and their possible values are printed to standard output. This functionality acts as a built-in help mechanism for data attributes. (Note that in this case, the argument s is not referenced, but simply causes MATLAB to call the SET function associated with imat_shp objects.)

If the reference to the input variable s includes subscripts, you must assign the output from SET as in the 3rd example above, otherwise MATLAB will issue an error.

To change attribute values, you must either supply pairs of attribute names and values (syntax 2), or you must supply a scalar structure variable (like the one returned by get) whose field names are the attribute names to be changed, and whose field values are the desired values (syntax 3).

The attribute names can be any valid attribute for the imat_shp object. Attribute values can either be a single value (in which case the value is used to set all elements of s), or an array of values dimensioned the same size as s. A cell array of strings should be used to set string or list attributes. The Node and Shape attributes are special cases. These can be set either to Nx1 arrays (in which case the same values will be used for all elements of s), or they can be dimensioned the same size as s with an extra first dimension equal to the number of nodes or shape coefficients. This is consistent with the values returned by the get function. (Also, NaN values at the end of a column will be discarded when setting that element.)

The attributes are set in the order listed. Note that setting some attributes will cause side effects:

An alternative way to set attributes is with the syntax s.attrib=value.

Examples

>> s=imat_shp(3);
>> s=set(s,'frequency',[12.35 ; 22.87; 29.02]);
>> s=set(s,'damping',[0.013 ; 0.009; 0.022], 'modalmassreal', 1.0);
>> s=set(s,'node',(1:10)', 'doftype', '3dof');
>> s=set(s,'shape', rand(30,3));
>> s

s =

3x1 IMAT Shape with the following attributes:
Row Frequency           Damping             NumberNodes
--- ------------------- ------------------- -------------------
1   12.35               0.013               10
2   22.87               0.009               10
3   29.02               0.022               10

>>

See Also

imat_shp, imat_shp/get, imat_shp/setdef