Interfacing function
eng


CORR_c title

File content


//CORR_c Scicos Correlation block
//Classical interface function ver1.0 - scicoslab 4.3
//1 Juin 2009 - INRIA - Author : A.Layec
function [x,y,typ]=CORR_c(job,arg1,arg2)
 x=[];
 y=[];
 typ=[];

 select job
  case 'plot' then
    standard_draw(arg1)
  case 'getinputs' then
    [x,y,typ]=standard_inputs(arg1)
  case 'getoutputs' then
    [x,y,typ]=standard_outputs(arg1)
  case 'getorigin' then
    [x,y]=standard_origin(arg1)
  case 'set' then
    x=arg1
    graphics=arg1.graphics;
    model=arg1.model
    exprs=graphics.exprs

    while %t do

      [ok,outsz,typ,exprs] = getvalue('Scicos Correlation block',...
          ['Output vector size (-1:same as inputs) :';
           'Compute input mean (0:no,1:yes) :'],...
           list('vec',1,'vec',1),exprs);

      if ~ok then break,end;

      if ok then
        if outsz>0 then
          [model,graphics,ok] = set_io(model,graphics,list([-1,-2;-1,-2],[1,1]),list([outsz,-2],1),[],[])
        else
          [model,graphics,ok] = set_io(model,graphics,list([-1,-2;-1,-2],[1,1]),list([-1,-2],1),[],[])
        end
        model.ipar     = [typ]
        graphics.exprs = exprs;
        x.graphics     = graphics;
        x.model        = model;
        break;
      end

   end

 case 'define' then
   typ   = 1
   outsz = -1

   model           = scicos_model()
   model.sim       = list('corrblk',4)
   model.in        =  [-1;-1]
   model.in2       =  [-2;-2]
   model.intyp     =  [1;1]
   model.out       =  outsz
   model.out2      =  -2
   model.outtyp    =  1
   model.evtin     =  []
   model.ipar      =  [typ]
   model.blocktype =  'd'
   model.dep_ut    =  [%t %f]

   gr_i  =  ['txt=[''Correlation''];';
             'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
   label = [string(outsz);string(typ)]
   x     = standard_define([2.5 2],model,label,gr_i)
 end
endfunction