📄 downsmpl_f.sci
字号:
//DOWNSMPL_f Scicos downsample block
//Classical interface function ver1.0 - scilab-3
//29 janvier 2004 Author : - IRCOM GROUP - A.Layec
function [x,y,typ]=DOWNSMPL_f(job,arg1,arg2)
x=[];y=[];typ=[]
select job
case 'plot' then
nech=arg1.model.ipar(1);
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
text=['Set Downsample block']
[ok,ny,nech,init,herit,exprs]=getvalue(text,...
['Size of outputs';'Downsample factor';'Offset';...
'Accept herited events 0/1'],...
list('vec',1,'vec',1,'vec',1,'vec',1),exprs)
if ~ok then break,end;
//test
if ~is_int(ny) then
message('The size of outputs must be integer.')
ok=%F
elseif ~is_int(nech) then
message('The downsample factor must be integer.')
ok=%F
elseif ~is_int(init) then
message('The offset must be integer.')
ok=%F
end
if ok then
//ATTENTION
graphics.gr_i(1)(9)='xstring(orig(1)+0.55*sz(1),orig(2)+0.4*sz(2),string(nech(1)),0,0)'
nu=ny*nech
if herit==1 then
model.dep_ut=[%t %f]
[model,graphics,ok]=check_io(model,graphics,nu,ny,[],[])
else
model.dep_ut=[%f %f]
[model,graphics,ok]=check_io(model,graphics,nu,ny,1,[])
end
graphics.exprs=exprs
model.in=nu
model.out=ny
model.dstate=init
model.ipar=[nech]
x.graphics=graphics;x.model=model
break;
end
end
case 'define' then
ny=64
herit=1
nech=8
nu=nech*ny
init=0
model=scicos_model()
model.sim=list('sousecht',4)
model.in=nu
model.out=ny
model.evtin=[]
model.evtout=[]
model.dstate=init
model.rpar=[]
model.ipar=[nech]
model.blocktype='d'
model.firing=[]
model.dep_ut=[%t %f]
gr_i=['thick=xget(''thickness'')'
'pat=xget(''pattern'')'
'fnt=xget(''font'')'
'l=0.15;h=0.2';
'x0=0.31;y0=0.8;y1=0.35'
'x1=x0-l/2;x2=x0+l/2;y2=y1-h'
'xpoly(orig(1)+[x0;x0]*sz(1),orig(2)+[y0;y1]*sz(2),""lines"")'
'xfpoly(orig(1)+[x1;x2;x0]*sz(1),orig(2)+[y1;y1;y2]*sz(2),1)'
'xstring(orig(1)+0.55*sz(1),orig(2)+0.4*sz(2),""M"",0,0)' //attention
'xset(''thickness'',thick)'
'xset(''pattern'',pat)'
'xset(''font'',fnt(1),fnt(2))'
]
exprs=[string(ny),string(nech),string(init),string(herit)]
x=standard_define([2 2],model,exprs,gr_i)
end
endfunction
//X est une matrice de r閑ls
//tt est un boolean
function tt=is_int(X)
Y=matrix(X,size(X,'*'),1);
Z=int(X);
tt=%t;
for i=1:size(Y,1)
if (Z(i)-Y(i))<>0 then
tt=tt&%f;
else
tt=tt&%t;
end
end
endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -