1
function [x,y,typ]=CMSCOPE(job,arg1,arg2)
8
[x,y,typ]=standard_inputs(o)
12
[x,y]=standard_origin(arg1)
15
graphics=arg1.graphics;exprs=graphics.exprs
16
if size(exprs)<11 then exprs(11)=emptystr(),end // compatibility
20
[ok,in,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs]=getvalue(..
21
'Set Scope parameters',..
23
'Drawing colors (>0) or mark (<0)';
24
'Output window number';
25
'Output window position';
26
'Output window sizes';
31
'Accept herited events 0/1'
32
'Name of Scope (label&Id)'],..
33
list('vec',-1,'vec',-1,'vec',1,'vec',-1,'vec',-1,..
34
'vec','size(%1,''*'')','vec','size(%1,''*'')','vec',1,..
35
'vec',1,'vec',1,'str',1),exprs)
36
if ~ok then break,end //user cancel modification
38
if size(in,'*')<=0 then
39
mess=[mess;'Block must have at least one input port';' ']
43
mess=[mess;'Port sizes must be positive';' ']
46
if size(clrs,'*')<sum(in) then
47
mess=[mess;'Not enough colors defined (at least '+string(sum(in))+')';' ']
50
if size(wpos,'*')<>0 &size(wpos,'*')<>2 then
51
mess=[mess;'Window position must be [] or a 2 vector';' ']
54
if size(wdim,'*')<>0 &size(wdim,'*')<>2 then
55
mess=[mess;'Window dim must be [] or a 2 vector';' ']
59
mess=[mess;'Window number can''t be < -1';' ']
63
mess=[mess;'Refresh period must be positive';' ']
67
mess=[mess;'Buffer size must be at least 2';' ']
70
if or(ymin>=ymax) then
71
mess=[mess;'Ymax must be greater than Ymin';' ']
74
if ~or(heritance==[0 1]) then
75
mess=[mess;'Accept herited events must be 0 or 1';' ']
79
message(['Some specified values are inconsistent:';
83
[model,graphics,ok]=check_io(model,graphics,in,[],ones(1-heritance,1),[])
86
if wpos==[] then wpos=[-1;-1];end
87
if wdim==[] then wdim=[-1;-1];end
89
yy=[ymin(:)';ymax(:)']
92
ipar=[win;size(in,'*');N;wpos(:);wdim(:);in(:);clrs(:);heritance]
93
if prod(size(dstate))<>(sum(in)+1)*N+1 then
94
dstate=-eye((sum(in)+1)*N+1,1),
96
model.evtin=ones(1-heritance,1)
97
model.dstate=dstate;model.rpar=rpar;model.ipar=ipar
100
graphics.exprs=exprs;
101
x.graphics=graphics;x.model=model
111
clrs=[1;3;5;7;9;11;13;15];
114
ymin=[-1;-5];ymax=[1;5];per=30;
115
yy=[ymin(:)';ymax(:)']
118
model.sim=list('cmscope',4)
121
model.rpar=[0;per;yy(:)]
122
model.ipar=[win;size(in,'*');N;wpos(:);wdim(:);in(:);clrs(1:sum(in))]
126
exprs=[strcat(string(in),' ');
127
strcat(string(clrs),' ');
131
strcat(string(ymin),' ');
132
strcat(string(ymax),' ');
137
gr_i='xstringb(orig(1),orig(2),''MScope'',sz(1),sz(2),''fill'')'
138
x=standard_define([2 2],model,exprs,gr_i)