~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/GAIN_f.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ]=GAIN_f(job,arg1,arg2)
 
2
// Copyright INRIA
 
3
x=[];y=[];typ=[];
 
4
select job
 
5
case 'plot' then
 
6
  standard_draw(arg1)
 
7
case 'getinputs' then
 
8
  [x,y,typ]=standard_inputs(arg1)
 
9
case 'getoutputs' then
 
10
  [x,y,typ]=standard_outputs(arg1)
 
11
case 'getorigin' then
 
12
  [x,y]=standard_origin(arg1)
 
13
case 'set' then
 
14
  x=arg1;
 
15
  graphics=arg1(2);label=graphics(4)
 
16
  model=arg1(3);
 
17
  while %t do
 
18
    [ok,gain,label]=getvalue('Set gain block parameters',..
 
19
        ['Gain'],list('mat',[-1,-1]),label(1))
 
20
    if ~ok then break,end
 
21
    if gain==[] then
 
22
      message('Gain must have at least one element')
 
23
    else
 
24
      [out,in]=size(gain)
 
25
      [model,graphics,ok]=check_io(model,graphics,in,out,[],[])
 
26
      if ok then
 
27
        graphics(4)=label
 
28
        model(8)=gain(:);
 
29
        x(2)=graphics;x(3)=model
 
30
        break
 
31
      end
 
32
    end
 
33
  end
 
34
  x(3)(11)=[] //compatibility
 
35
case 'define' then
 
36
  in=1;out=1;gain=1
 
37
  model=list('gain',in,out,[],[],[],[],gain,[],'c',[],[%t %f],' ',list())
 
38
  label=[strcat(sci2exp(gain));strcat(sci2exp(in));strcat(sci2exp(out))]
 
39
  gr_i=['[nin,nout]=model(2:3);';
 
40
      'if nin*nout==1 then gain=string(model(8)),else gain=''Gain'',end';
 
41
      'dx=sz(1)/5;';
 
42
      'dy=sz(2)/10;';
 
43
      'xx=orig(1)+      [1 4 1 1]*dx;';
 
44
      'yy=orig(2)+sz(2)-[1 5 9 1]*dy;';
 
45
      'xpoly(xx,yy,''lines'');';
 
46
      'w=sz(1)-2*dx;h=sz(2)-2*dy;';
 
47
      'xstringb(orig(1)+dx,orig(2)+dy,gain,w,h,''fill'');']
 
48
  x=standard_define([2 2],model,label,gr_i)
 
49
end
 
50
 
 
51
 
 
52
 
 
53