stack_get,stack_set,stack_rm

stack_get,stack_set,stack_rm#

Purpose

Stack handling functions.

Syntax

[StackRows,index]=stack_get(model,typ);
[StackRows,index]=stack_get(model,typ,name);
[StackRows,index]=stack_get(model,typ,name,opt);
Up=stack_set(model,typ,name,val)
Up=stack_rm(model,typ,name);
Up=stack_rm(model,typ);
Up=stack_rm(model,'',name);
[model,r1]=stack_rm(model,typ,name,opt);

Description

The .Stack field is used to store a variety of information, in a N by 3 cell array with each row of the form {'type','name',val} (see section 7.6 or section 7.7 for example). The purpose of this cell array is to deal with an unordered set of data entries which can be classified by type and name.

Since sorting can be done by name only, names should all be distinct. If the types are different, this is not an obligation, just good practice.

In get and remove calls, typ and name can start by # to use a regular expression based on matching (use doc regexp to access detailed documentation on regular expressions). To avoid selection by typ or name one can set it to an empty string.

Command options can be given in opt to recover stack lines or entries.

  • stack_get outputs selected sub-stack lines by default.
    • Using opt set to get or to GetData allows directly recovering the content of the stack entry instead of the stack line.
    • Using opt set to multi asks to return sub stack lines for multiple results, this is seldom used.
  • stack_rm outputs the model from which stack lines corresponding to typ and name have been removed.
    • Using opt set to get will output in a second argument the removed lines.
    • Using opt set to GetData will output in a second argument the content of the removed lines. If several lines are removed,

Syntax

% Sample calls to stack_get and stack_rm
Case.Stack={'DofSet','Point accel',[4.03;55.03];
            'DofLoad','Force',[2.03];
            'SensDof','Sensors',[4 55 30]'+.03};

% Replace first entry Case=stack_set(Case,'DofSet','Point accel',[4.03;55.03;2.03]); Case.Stack

% Add new entry Case=stack_set(Case,'DofSet','P2',[4.03]); Case.Stack

% Remove entry Case=stack_rm(Case,'','Sensors');Case.Stack

% Get DofSet entries and access [Val,ind]=stack_get(Case,'DofSet') Case.Stack{ind(1),3} % same as Val{1,3} % Direct access to cell content [Val,ind]=stack_get(Case,'DofSet','P2','get')

% Regular expression match of entries starting with a P stack_get(Case,'','#P*')

% Remove Force entry and keep it [Case,r1]=stack_rm(Case,'','Force','get')

SDT provides simplified access to stacks in feplot (see section 4.4.3) and iiplot figures (see section 2.1.2). cf.Stack{'Name'} can be used for direct access to the stack, and cf.CStack{'Name'} for access to FEM model case stacks.