Extractor
Keywords: main

Subsections

- Library
- Description
- Dialog Box
- Default properties
- Interfacing function
- Computational function (type 4)

##
Extractor

### Library

Branching

### Description

It extracts values from an input vector. For example if the input is of size 4 and we qre interested only in the 3rd and first components (in that order), block parameter should be set to 3 1.

### Dialog Box

Set block parameters |
indices to extract | 1

- indices to extract: vector indicating the components to be extracted.

### Default properties

- always active: no
- direct-feedthrough: yes
- zero-crossing: no
- mode: no
- number/sizes of inputs: 1 / -1
- number/sizes of outputs: 1 / 1
- number/sizes of activation inputs: 0 /
- number/sizes of activation outputs: 0 /
- continuous-time state: no
- discrete-time state: no
- name of computational function: extractor

### Interfacing function

`scilab/macros/scicos_blocks/branching/EXTRACTOR.sci`

### Computational function (type 4)

    #include "scicos_block.h"
    #include <math.h>

    void extractor(scicos_block *block,int flag)
    {
      int i,j;
      if(flag==1){
        for(i=0;i<block->nipar;++i){
          j=block->ipar[i]-1;
          if(j<0) j=0;
          if(j>=block->insz[0]) j=block->insz[0]-1;
          block->outptr[0][i]=block->inptr[0][j];
        }
      }
    }