📄 vectorscope_f.sci
字号:
//VECTORSCOPE_f Scicos vector scope block
//Classical interface function ver1.0 - scilab-2.7
//16 novembre 2003 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=VECTORSCOPE_f(job,arg1,arg2)
// Copyright INRIA
x=[];y=[];typ=[]
select job
case 'plot' then
standard_draw(arg1)
case 'getinputs' then
[x,y,typ]=standard_inputs(o)
case 'getoutputs' then
x=[];y=[];typ=[];
case 'getorigin' then
[x,y]=standard_origin(arg1)
case 'set' then
x=arg1;
graphics=arg1.graphics;exprs=graphics.exprs;
model=arg1.model;
//state=model(2)
while %t do
[ok,clrs,win,wpos,wdim,..
x_dim,y_dim,xvector,GRAPHlabel,grid,p2d3,exprs]=getvalue(..
'Set Scope parameters',..
['Color (>0) or mark (<0) ';
'Output window number';
'Output window position';
'Output window sizes';
'Xmin Xmax';
'Ymin Ymax';
'X vector';
'Graph label';
'Xgrid(0/1)';
'plot2d3(0/1)'],..
list('vec',1,'vec',1,'vec',-1,'vec',-1,'vec',2,..
'vec',2,'vec',-1,'str',1,'vec',1,'vec',1),exprs)
if ~ok then break,end //user cancel modification
xmin=x_dim(1);xmax=x_dim(2);
ymin=y_dim(1);ymax=y_dim(2);
in_size=length(xvector)
mess=[]
if size(wpos,'*')<>0 &size(wpos,'*')<>2 then
mess=[mess;'Window position must be [] or a 2 vector';' ']
ok=%f
end
if size(wdim,'*')<>0 &size(wdim,'*')<>2 then
mess=[mess;'Window dim must be [] or a 2 vector';' ']
ok=%f
end
if win<0 then
mess=[mess;'Window number can''t be negative';' ']
ok=%f
end
if ymin>=ymax then
mess=[mess;'Ymax must be greater than Ymin';' ']
ok=%f
end
if xmin>=xmax then
mess=[mess;'Xmax must be greater than Xmin';' ']
ok=%f
end
if in_size==0 then
mess=[mess;'Xvector must be defined';' ']
ok=%f
end
if length(GRAPHlabel)>40 then
mess=[mess;'Graph label too long (max 40)';' ']
ok=%f
end
if ~or(grid==[0 1]) then
mess=[mess;'Xgrid option must be 0 or 1';' ']
ok=%f
end
if ~or(p2d3==[0 1]) then
mess=[mess;'Plot2d3 option must be 0 or 1';' ']
ok=%f
end
if ~ok then
message(['Some specified values are inconsistent:';
' ';mess])
end
if ok then
[model,graphics,ok]=check_io(model,graphics,in_size,[],1,[])
end
if ok then
if wpos==[] then wpos=[-1;-1];end
if wdim==[] then wdim=[-1;-1];end
rpar=[xmin;xmax;ymin;ymax;xvector(:)]
GRAPHlabelsize=length(GRAPHlabel);
GRAPHlabelCODE=str2code(GRAPHlabel);
option=grid+p2d3*2
ipar=[win;clrs;1;1;1;wpos(:);wdim(:);in_size;option;..
GRAPHlabelsize;GRAPHlabelCODE(:)];
model.dstate=zeros(in_size,1);
model.rpar=rpar(:);
model.ipar=ipar(:);
model.in=in_size;
graphics.exprs=exprs;
x.graphics=graphics;x.model=model
break
end
end
case 'define' then
win=1;
wdim=[300;200]
wpos=[-1;-1]
clrs=[1];
xvector=-20:5:20;
in_size=length(xvector);
GRAPHlabel='VECTORSCOPE.C';
GRAPHlabelsize=length(GRAPHlabel);
GRAPHlabelCODE=str2code(GRAPHlabel);
xmin=-15;xmax=+15;
ymin=-15;ymax=+15;
grid=0
p2d3=0
option=grid+p2d3*2
model=scicos_model()
model.sim=list('vectorscope',2)
model.in=in_size
model.out=[]
model.evtin=1
model.evtout=[]
model.dstate=zeros(in_size,1)
model.ipar=[win;clrs;1;1;1;wpos;wdim;in_size;option;GRAPHlabelsize;GRAPHlabelCODE(:)]
model.rpar=[xmin;xmax;ymin;ymax;xvector(:)]
model.blocktype='d'
model.firing=[]
model.dep_ut=[%f %f]
exprs=[string(clrs);
string(win);
sci2exp([]);
sci2exp(wdim);
string(xmin)+" "+string(xmax);
string(ymin)+" "+string(ymax);
strcat(string(xvector),' ');
GRAPHlabel;
string(grid);
string(p2d3)];
gr_i=['txt=[''Vector Scope'']';'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
x=standard_define([2 2],model,exprs,gr_i)
end
endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -