0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 function [Volv1,Volv2] = plt(varargin);
0011
0012 global copia;
0013
0014 Volv1 = 0;
0015
0016 if ~nargin
0017 eval('evalin(''base'',''pltdef'','''')');
0018 w = plt('select','base','who');
0019 lix = length(w); b = zeros(1,lix);
0020 opcion = [];
0021 wstruct = {}; ws=0;
0022 rnsion = 6;
0023 for k=1:lix
0024 a = plt('select','base',w{k});
0025 if length(w{k})>6 & findstr(w{k},'pltopt') opcion = [opcion a]; end;
0026 if strcmp(w{k},'TraceIDlen') rnsion = a; end;
0027 if isnumeric(a) & length(a)>3 b(k)=1;
0028 elseif isstruct(a) & numel(a)==1
0029 f = fieldnames(a);
0030 for fn=1:length(f)
0031 g = getfield(a,f{fn});
0032 if isnumeric(g) & length(g)>3 ws=ws+1; wstruct{ws} = [w{k} '.' f{fn}]; end;
0033 end;
0034 end;
0035 end;
0036 w = [w(logical(b)); wstruct']; nov = length(w);
0037 if nov<2 disp('Not enough vectors to plot'); return; end;
0038 spix = get(0,'screenpix');
0039 Sfuente = (196-spix)/10;
0040 spix = spix/80 - .2;
0041 espaciV = round(20 * spix);
0042 espaciH = round(200 * spix);
0043 set(0,'units','pix'); ssz = get(0,'screensize');
0044 fct = fix((ssz(4)-110)/espaciV);
0045 nov1 = nov+3; fct = ceil(nov1/fct);
0046 nr = ceil(nov1/fct);
0047 wid = fct*espaciH+20; hei = nr*espaciV+40;
0048 fig = figure('menu','none','number','off','name','PLT select','color','black',...
0049 'Invert','on','pos',[ssz(3)-wid-5 ssz(4)-hei-65 wid hei]);
0050 axes('xli',[0 fct],'yli',[0 nr]-.5,'pos',[.02/fct 0 1 1],...
0051 'color','black','xcol','black','ycol','black');
0052 hb = hei-25;
0053 set([uicontrol('str','Plot', 'pos',[ 5 hb 40 21],'call','plt select plot;');
0054 uicontrol('str','CloseAll','pos',[ 60 hb 60 21],'call','plt close;');
0055 uicontrol('str','Help', 'pos',[135 hb 40 21],'call','plt(''helpv'',0);');
0056 ],'units','nor','fontsi',Sfuente);
0057 absc=nr-3; x=0;
0058 set([text(0,absc+1.1,'Right click on desired x vectors');
0059 text(0,absc+.45, 'Left click on desired y vectors');
0060 text(0,absc-.2, 'Double click for right hand axis');
0061 ],'fonta','ita','fontsi',9,'color',[.5 .5 1]);
0062 txt = zeros(nov,1); sz1=txt; sz2=txt; len=txt; nvec=txt; sxy=txt; yderecho=txt;
0063 for k=1:nov
0064 absc = absc-1; if absc<0 absc=nr-1; x=x+1; end;
0065 sz = size(plt('select','base',w{k}));
0066 sz1(k) = sz(1);
0067 sz2(k) = sz(2);
0068 len(k) = max(sz);
0069 nvec(k) = min(sz);
0070 txt(k) = text(x,absc,' ');
0071 set(txt(k),'ButtonD',['plt(''select'',' int2str(k) ');']);
0072 end;
0073 set(fig,'use',[txt sz1 sz2 len nvec sxy yderecho]);
0074 setappdata(fig,'w',w);
0075 setappdata(fig,'opt',opcion);
0076 setappdata(fig,'IDlen',rnsion);
0077 plt('select','text');
0078 return;
0079 end;
0080
0081 y1 = varargin{1};
0082 if ~ischar(y1) y1='none'; end;
0083 if y1(1)=='g' y1(1)='G'; end;
0084 switch sum(y1)
0085 case 640
0086 v2 = varargin{2};
0087 if isnumeric(v2) | v2(1) ~= 'b'
0088 w = getappdata(gcf,'w'); e = get(gcf,'use');
0089 len = e(:,4); sxy = e(:,6); nov = length(len);
0090 xk = []; for k=1:nov if sxy(k)<0 xk = [xk k]; end; end;
0091 end;
0092 switch sum(v2)
0093 case 411, Volv1 = eval(['evalin(''base'',''' varargin{3} ''');']);
0094 case 453,
0095 lnxk = length(xk);
0096 for k=1:nov
0097 s = w{k}; if length(s)>20 s=s(1:20); end;
0098 s = strrep(s,'_','\_');
0099 s = [s ' (' int2str(e(k,2)) ',' int2str(e(k,3)) ')'];
0100 if sxy(k) s = [s ' \leftarrow ']; s2 = int2str(abs(sxy(k))); end;
0101 c = [1 1 1];
0102 if lnxk
0103 if lnxk==1 s2 = ''; end;
0104 if ~sxy(k)
0105 if ~length(find(len(xk)==len(k))) c = .5*c; end;
0106 elseif sxy(k)<0 c = [.9 .3 .3]; s = [s 'x' s2];
0107 else
0108 if e(k,7) c = [ 1 .6 .2]; s = [s 'y' s2 'R'];
0109 else c = [ 1 1 0]; s = [s 'y' s2];
0110 end;
0111 end;
0112 else if e(k,5) ~= 1 c = .5*c; end;
0113 end;
0114 if c(3)==.5 | c(3)==1 bold = 'norm'; else bold = 'bold'; end;
0115 set(e(k,1),'color',c,'fontw',bold,'str',s);
0116 end;
0117 case 447
0118 if ~max(sxy) return; end;
0119 opcion = getappdata(gcf,'opt');
0120 rnsion = getappdata(gcf,'IDlen');
0121 opt = [];
0122 for k=1:length(opcion)
0123 t = opcion{k};
0124 if isnumeric(t) v = num2str(t);
0125 if length(t)>1 v = ['[' v ']']; end;
0126 else v = ['''''' t ''''''];
0127 end;
0128 opt = [opt v ','];
0129 end;
0130 if length(xk)==1 x = w{find(sxy<0)}; else x = 'X axis'; end;
0131 derecho = [];
0132 ny = 0;
0133 nvL = 0; nvR = 0;
0134 func = ['plt(''''LabelX'''',''''' x ''''','];
0135 id = '''''TraceID'''',[''''';
0136 for k=1:nov
0137 if sxy(k)>0
0138 nvec = e(k,5);
0139 x = w{find(sxy==-sxy(k))}; absc = w{k};
0140 s2 = strrep(absc,'_','\_');
0141 ss = strrep(absc,'_','');
0142 nn = rnsion - (nvec>1); s = [];
0143 if length(ss) > nn
0144 sp = findstr(ss,'.');
0145 if length(sp)
0146 nn1 = min(sp-1,floor((nn-1)/2));
0147 nn2 = min(nn-nn1-1,length(ss)-sp);
0148 nn1 = nn - nn2 - 1;
0149 ss = ss([1:nn1-1 sp-1:sp+nn2-1 end]);
0150 else
0151 ss = [ss(1:nn-1) ss(end)];
0152 end;
0153 end;
0154 while length(ss) < nn ss = [ss ' ']; end;
0155 st = ss;
0156 for v = 1:nvec
0157 if nvec>1 ss = [st '0'+mod(v,10)]; end;
0158 s = [s ss ''''';'''''];
0159 end;
0160 if e(k,7) derecho = [derecho ny+(1:nvec)]; s2R=s2; nvR=nvR+1; else s2L=s2; nvL=nvL+1; end;
0161 ny = ny + nvec;
0162 func = [func x ',' absc ','];
0163 id = [id s];
0164 end;
0165 end;
0166 if nvL==1 func = [func '''''LabelY'''',''''' s2L ''''',']; end;
0167 if nvR==1 func = [func '''''LabelYr'''',''''' s2R ''''',']; end;
0168 if nvR>0 func = [func '''''Right'''',' plt('vtoa','%d',derecho) ',']; end;
0169 if ny>1 func = [func id(1:end-3) '],']; end;
0170 func = [func opt];
0171 func = [func(1:end-1) ');'];
0172 plt('select','base',func);
0173 otherwise,
0174 clic = get(gcf,'SelectionT'); clic = clic(1); sk = sxy(v2);
0175 if clic=='a' | ~length(xk)
0176 if sk>=0
0177 if e(v2,5)==1 e(v2,6) = min(sxy)-1; end;
0178 else e(v2,6) = 0;
0179 e(find(sxy==-sk),6)=0;
0180 end;
0181 elseif sk>=0
0182 if clic=='o' & sk sk = 0; end;
0183 xki = sort(-sxy(xk(find(len(xk)==len(v2)))));
0184 if length(xki)
0185 if sk liy = find(xki==sk)+1;
0186 if liy>length(xki) sk=0; e(v2,7)=0; else sk=xki(liy); end;
0187 else sk = xki(1);
0188 end;
0189 e(v2,6) = sk;
0190 if clic=='o' & sk e(v2,7)=1; end;
0191 end;
0192 end;
0193 set(gcf,'use',e);
0194 plt('select','text');
0195 end;
0196
0197 case 756
0198 x = varargin{2};
0199 liy=0; nv=x;
0200 if ~x Volv1=''; Volv2=1; return; end;
0201 while nv>900 liy=liy+1; nv=.001*nv; end;
0202 while nv<.9 liy=liy-1; nv=1000*nv; end;
0203 if (liy==1 & x<10000) | (liy==-1 & x>=.1 ) liy=0; nv=x; end;
0204 Volv2 = nv/x;
0205 if liy>5 Volv1 = plt('ftoa','%4w',1/Volv2);
0206 elseif liy<-6 Volv1 = plt('ftoa','%5w',1/Volv2);
0207 else qs=reshape('Atto FemtoPico Nano MicroMilli Kilo Mega Giga Tera Peta ',5,12)';
0208 Volv1 = deblank(qs(liy+7,:));
0209 end;
0210 if length(Volv1) Volv1 = [Volv1 '-']; end;
0211
0212 case 426
0213
0214 Csena = varargin{2}; val = varargin{3}; val = val(:);
0215 if length(val) > 1
0216 if nargin < 4 arado = ' '; else arado = varargin{4}; end;
0217 Volv1 = '';
0218 for k=1:length(val) Volv1 = [Volv1 plt('ftoa',Csena,val(k)) arado]; end;
0219 Volv1 = Volv1(1:end-length(arado));
0220 return;
0221 end;
0222 atir = length(Csena); vrto = Csena(atir);
0223 while vrto==' ' atir=atir-1; vrto = Csena(atir); end;
0224 if vrto=='w' | vrto=='v'
0225 v = s2i(Csena(2:atir-1));
0226 absc = abs(val);
0227 if isnan(val) Volv1 = 'NaN'; return; end;
0228 if ~val Volv1='0'; if vrto=='v' Volv1=[blanks(v) Volv1]; end; return;
0229 elseif val<0 vv = v-1;
0230 else vv = v;
0231 end;
0232 if absc < 1.0e-99 pf = [7 1 2 2]; elseif absc < 1.0e-9 pf = [6 2 2 3];
0233 elseif absc < 0.01 pf = [5 1 4 4]; elseif absc < 10.0^vv pf = [1 1 1 1];
0234 elseif absc < 1.0e10 pf = [4 1 5 5]; elseif absc < 1.0e100 pf = [5 2 3 4];
0235 else pf = [6 3 1 3];
0236 end;
0237 pf = pf - 1;
0238 fp = v-pf(1); if val<0 fp=fp-1; end;
0239 if fp<0 Volv1='0'; return; end;
0240 if pf(1) tipo = 'e'; else tipo = 'g'; end;
0241 if ~fp pf = pf + [0,1,-1,-1]; end;
0242 Volv1 = sprintf(sprintf('%%1.%d%c',fp,tipo),val);
0243 lix = length(Volv1);
0244 if pf(1) pf = [1:v-pf(2) v+pf(3):v+pf(4)];
0245 else pf = 1:min(v+1,lix); end;
0246 if max(pf)<=lix Volv1 = Volv1(pf); else Volv1 = '0'; end;
0247 if vrto=='v'
0248 zp = v-length(Volv1);
0249 if isempty(findstr('.',Volv1))
0250 if zp>0 Volv1 = [Volv1 '.']; end;
0251 else zp = zp + 1;
0252 end;
0253 for k=1:zp Volv1 = [Volv1 '0']; end;
0254
0255 end;
0256 else
0257 Volv1 = sprintf(Csena,val);
0258 end;
0259
0260 case 442
0261 tipo = varargin{2}; v = varargin{3};
0262 if nargin < 4 arado = ' '; else arado = varargin{4}; end;
0263 Volv1 = plt('ftoa',tipo,v,arado);
0264 if length(v)>1 Volv1 = ['[' Volv1 ']']; end;
0265 case 759
0266 c = datevec(varargin{2});
0267 if isempty(c) | isnan(c(1)) Volv1 = []; return; end;
0268 if nargin<3 tipo=0; else tipo=varargin{3}; end;
0269 frac = sprintf('%4.3f',mod(c(6),1));
0270 c(6) = floor(c(6));
0271 if strcmp(frac,'1.000')
0272 if c(6)==59 frac = '0.999'; else c(6) = c(6)+1; end;
0273 end;
0274 Volv1 = [datestr(datenum(c),tipo) frac(2:end)];
0275 if strcmp(Volv1(7:9),'-20') Volv1(8:9) = []; end;
0276 case 543
0277 if varargin{2} f = get(gcbo,'use'); else f = ''; end;
0278 if isempty(f)
0279 if ispc f = 'plt.chm'; else f = 'plt.htm'; end;
0280 end;
0281 if isempty(findstr(f,filesep))
0282 foobar = 0;
0283 if exist('foobar')
0284 f = feval('which',f);
0285 else f = fullfile(fileparts(GetExe),f);
0286 end;
0287 end;
0288 if exist(f)
0289 if strcmpi(f(end-2:end),'chm') dos(['hh ' f ' &']);
0290 elseif exist('foobar') feval('web',['file:///' f ],'-browser');
0291 else ibrowse(f);
0292 end;
0293 end;
0294
0295 case 335
0296
0297 k = 2; a1 = varargin{2};
0298 if ischar(a1)
0299 g = gca;
0300 a = [0 .3 .4];
0301 a = axes('vis','of','XtickL',' ','YtickL',' ','TickLen',[0 0]','color',a,'xcol',a,'ycol',a);
0302 pd = {a [.1 1 .9] [0 0] 'none' [] 0 '' 1 1};
0303 Volv1 = text(0,0,'','use',pd,'interp','none','color',[1 1 .4]);
0304 set(Volv1,'ButtonD',['plt(''pop'',' int2str(Volv1*8192) ',''open'',0);']);
0305 axes(g);
0306 else lix = length(a1); Volv1 = a1;
0307 if lix==1 if Volv1>8192 Volv1=Volv1/8192; end;
0308 k=k+1; pd=get(Volv1,'use'); a=pd{1};
0309 else paraN = varargin{3}; param = varargin{4}; s = size(param,1);
0310 if s for k=1:lix plt('pop',Volv1(k),paraN,param(min(k,s),:)); end;
0311 else for k=1:lix plt('pop',Volv1(k),paraN,[]); end;
0312 end;
0313 return;
0314 end;
0315 end;
0316 while k <= length(varargin)
0317 paraN = lower(varargin{k}); param = varargin{k+1}; k=k+2;
0318 switch sum(paraN)
0319 case 857, if max(param)>1 s='pixels'; else s='normal'; end;
0320 if length(param)<2 fp=get(a,'pos'); param=[fp(1:3) param]; end;
0321 set(a,'pos',param,'units',s);
0322 case 734, lix = length(param); pd{6} = param;
0323 set(Volv1,'str',param{1},'pos',[.08 .5-lix],'use',pd);
0324 set(a,'yli',[-lix 0]);
0325 case 434, if ~pd{8} return; end;
0326 c = get(gcf,'SelectionT'); c = c(1);
0327 if c=='n'
0328 uh = findobj(pd{5},'vis','on');
0329 setappdata(Volv1,'Uhide',uh);
0330 set([Volv1; uh],'vis','of'); ch = pd{6}; lix = length(ch);
0331 of = pd{3}; p=get(a,'pos'); pt = p(4)+p(2)+of(2);
0332 s = get(a,'Units');
0333 if s(1)=='n' & pt>1
0334 of(2)=of(2)-pt+1; pd{3}=of; set(Volv1,'use',pd);
0335 end;
0336 set(a,'vis','on','pos',p+[of 0 0]); axes(a);
0337 s = ['plt(''pop'',' int2str(8192*Volv1) ',''index'','];
0338 for liy=1:lix
0339 ht = text(.08,.5-liy,ch{liy});
0340 set(ht,'interp',pd{4},'color',pd{2},'ButtonD',[s int2str(liy) ');']);
0341 if liy==pd{9} set(ht,'fontw','bol'); end;
0342 end;
0343 cr = get(a,'color'); z = zeros(1,lix-1);
0344 x = [z;z+1;z]; z = [z;z;z+NaN]; absc = 1:lix-1; absc = -[absc;absc;absc];
0345 line('z',z(:),'y',absc(:),'x',x(:),'color',cr-.2+.4*(cr<.5));
0346 else
0347 lix = length(pd{6}); v = pd{9};
0348 if v==lix v=1; else v=v+1; end;
0349 plt('pop',Volv1,'index',v);
0350 end;
0351 case 410, pd{5} = param; set(Volv1,'use',pd);
0352 case 647, if length(param)<2 param=[0 param]; end; pd{3}=param; set(Volv1,'use',pd);
0353 case 759, pd{2} = param; set(Volv1,'use',pd);
0354 case 748, set(a,'color',param,'xcol',param,'ycol',param);
0355 case 658, pd{4} = param; set(Volv1,'use',pd,'interp',param);
0356 case 536, pd{9} = abs(param); set(Volv1,'use',pd); v = get(a,'vis');
0357 if v(2)=='n'
0358 of = pd{3};
0359 if any(of) set(a,'pos',get(a,'pos')-[of 0 0]); end;
0360 set(a,'vis','of'); ch = get(a,'child'); ch(find(ch==Volv1)) = [];
0361 delete(ch);
0362 uh = getappdata(Volv1,'Uhide');
0363 set([Volv1; uh],'vis','on');
0364 ch = gcf;
0365 matVer = version; mver = (matVer([1 3])-'0') * [10; 1];
0366 if mver<75 & matVer(2)=='.'
0367 set(ch,'Share','off');
0368 set(ch,'Share','on');
0369 end;
0370 end;
0371 kk = pd{6}{abs(param)}; set(Volv1,'str',kk);
0372 if param>0 evalRep(pd{7},{'@STR',kk,'@IDX',int2str(param)}); end;
0373 case 617, pd{7} = param; set(Volv1,'use',pd);
0374 case 320, Volv1 = pd{6}; xk = pd{9};
0375 switch sum(param)
0376 case 536, Volv1 = xk;
0377 case 663, Volv1 = Volv1{xk};
0378 case 734,
0379 otherwise, disp(['Invalid argv=' param ' in plt(''pop'',H,''get'',argv)']);;
0380 end;
0381 case 615, pd{8} = param; set(Volv1,'use',pd);
0382 otherwise, set(Volv1,paraN,param);
0383 end;
0384 end;
0385
0386 case 422
0387
0388 k = 2; a1 = varargin{2};
0389 if ischar(a1)
0390 pd = {'' 1 1 -1e9 1e9 1 1 '' '' '%7w'};
0391 Volv1 = text(0,0,'1','horiz','cent','color',[1 1 .4],'use',pd);
0392 set(Volv1,'ButtonD',['plt(''edit'',' int2str(Volv1*8192) ',''click'',0);']);
0393 else lix = length(a1); Volv1 = a1;
0394 if lix==1 if Volv1>8192 Volv1=Volv1/8192; end;
0395 k=k+1; pd=get(Volv1,'use'); a=pd{1};
0396 else paraN = varargin{3}; param = varargin{4}; s = size(param,1);
0397 if s for k=1:lix plt('edit',Volv1(k),paraN,param(min(k,s),:)); end;
0398 else for k=1:lix plt('edit',Volv1(k),paraN,[]); end;
0399 end;
0400 return;
0401 end;
0402 end;
0403 while k <= length(varargin)
0404 paraN = lower(varargin{k}); param = varargin{k+1}; k=k+2;
0405 switch sum(paraN)
0406 case 518,
0407 if param
0408 c = get(gcf,'CurrentChar');
0409 if ~length(c) c=666; end;
0410 if param==2 c=27; end;
0411 t = get(Volv1,'str'); u = get(Volv1,'color');
0412 p = findstr(t,'_'); lix = length(t); termi = 0; valuar = 0;
0413 switch abs(c)
0414 case 666,
0415 case 8, if p>1 t(p-1)=[]; end;
0416 case 127, if p==lix t='_';
0417 else t(p+1)=[];
0418 end;
0419 case 127, if p==lix t='_'; else t(p+1)=[]; end;
0420 case 28, if p>1 t(p)=t(p-1); t(p-1)='_'; end;
0421 case 29, if p<lix t(p)=t(p+1); t(p+1)='_'; end;
0422 case 27, termi = 1; t = pd{8};
0423 case 13, termi = 1;
0424 t(p) = [];
0425 if pd{7}
0426 tt=t; t = 'error';
0427 try, s = eval(tt);
0428 if pd{7}==-1 | pd{7}==length(s)
0429 if length(s)==1
0430 if isreal(s)
0431 s = max(min(s,pd{5}),pd{4});
0432 t = [' ' plt('ftoa',pd{10},s) ' '];
0433 else pd{6} = imag(s);
0434 t = pd{8};
0435 end;
0436 else t = ['[' num2str(s) ']'];
0437 end;
0438 if isreal(s) pd{3} = s; valuar = 1; end;
0439 end;
0440 end;
0441 else pd{3}=0; valuar=1;
0442 end;
0443 otherwise, t = strrep(t,'_',[c '_']);
0444 end;
0445 set(Volv1,'str',t);
0446 if termi
0447 set(Volv1,'use',pd,'color',u([3 1 2]),'erase','norm','interp',pd{9});
0448 set(gcf,'keypress','');
0449 if valuar evalRep(pd{1},{'@VAL',t,'@OBJ',int2str(8192*Volv1)}); end;
0450 end;
0451 else
0452 kp = get(gcf,'keypress'); f = findstr(kp,'click');
0453 if length(f)==1 kp(f+7) = '2'; eval(kp); return; end;
0454 if ~pd{2} return; end;
0455 c = get(gcf,'SelectionT'); c = c(1);
0456 if c ~= 'a'
0457 v = pd{3}; w = pd{6};
0458 if pd{7}==1 & abs(round(v/w)*w-v) < 1e-9
0459 cp = get(gca,'curre'); cp = cp(1,1);
0460 imX = get(gca,'xli'); rp = get(Volv1,'pos');
0461 cp = (cp-imX(1))/diff(imX) > rp(1);
0462 cp = w * (2*cp-1);
0463 s = v + cp;
0464 if s>pd{5} s=pd{4}; elseif s<pd{4} s=pd{5}; end;
0465 pd{3} = s; s = [' ' plt('ftoa',pd{10},s) ' '];
0466 set(Volv1,'str',s,'use',pd);
0467 evalRep(pd{1},{'@VAL',s,'@OBJ',int2str(8192*Volv1)});
0468 return;
0469 else c='a';
0470 end;
0471 end;
0472 if c=='a'
0473 t = get(Volv1,'str');
0474 if ~strcmp(t,'error') pd{8} = t; end;
0475 t = deblank(t); while(t(1)==' ') t(1)=[]; end;
0476 viehoc = get(Volv1,'color');
0477 pd{9} = get(Volv1,'interp');
0478 set(Volv1,'interp','none','str',[t '_'],'color',viehoc([2 3 1]),'erase','xor','use',pd);
0479 set(gcf,'keypress',['plt(''edit'',' int2str(Volv1*8192) ',''click'',1);']);
0480 end;
0481 end;
0482 case 320, Volv1 = pd{3};
0483 case 541, pd{3} = param; set(Volv1,'str',[' ' plt('ftoa',pd{10},param) ' '],'use',pd);
0484 case 617, pd{1} = param; set(Volv1,'use',pd);
0485 case 324, pd{4} = param; set(Volv1,'use',pd);
0486 case 326, pd{5} = param; set(Volv1,'use',pd);
0487 case 428, pd{6} = param; set(Volv1,'use',pd);
0488 case 642, pd{7} = param; set(Volv1,'use',pd);
0489 case 615, pd{2} = param; set(Volv1,'use',pd);
0490 case 649, pd{10} = param; set(Volv1,'use',pd);
0491 otherwise, set(Volv1,paraN,param);
0492 end;
0493 end;
0494
0495 case 643
0496 Hin = varargin{2};
0497 if length(Hin)>1
0498 if nargin>2 en1 = varargin{3}; else en1 = [50 0 100]; end;
0499 if nargin>3 en2 = varargin{4}; else en2 = ''; end;
0500 if nargin>4 en3 = varargin{5}; else en3 = ''; end;
0501 if nargin>5 en4 = varargin{6}; else en4 = 1; end;
0502 if nargin>6 en5 = varargin{7}; else en5 = '%6w'; end;
0503 if nargin>7 en6 = varargin{8}; else en6 = [.75 .75 .75; 0 1 1]; end;
0504
0505 if length(en1)<5 en1 = [en1 -1e99 1e99]; end;
0506 if ischar(en5) & length(en5(:,1))==1 en5 = {'%2w'; en5; '%3w'}; end;
0507 if iscell(en5) en5 = char(en5); end;
0508 if length(en6(:,1))<3 en6 = [en6; 0 0 0; 0 0 0]; end;
0509
0510 t = get(findobj('tag','PltSlider'),'Val');
0511 if iscell(t) Volv1 = 1+max([t{:}]);
0512 else Volv1 = 1+length(t);
0513 end;
0514 hs = zeros(1,8);
0515 hs(2) = uicontrol('sty','text','str',en2,'tag','PltSlider','Val',Volv1,'horiz','cent');
0516 if isempty(en2) set(hs(2),'vis','off'); end;
0517 hs(4) = uicontrol('sty','text','str','a','use',en5,'horiz','left');
0518 hs(5) = uicontrol('sty','text','str','a','use',en3,'horiz','right');
0519 hs(3) = uicontrol('sty','slid','use',en1(1),'call',sprintf('plt(''slider'',%d,''CBslide'');',Volv1));
0520 hs(6) = uicontrol('sty','edit','backg',en6(2,:),'foreg',en6(4,:),'use',en1(4:5),'horiz','cent',...
0521 'call',sprintf('plt(''slider'',%d,''CBedit'');',Volv1));
0522 set(hs(2:5),'backg',en6(1,:),'foreg',en6(3,:));
0523 en4 = [en4 10]; hs([7 8]) = en4(1:2);
0524 set(hs(2),'use',hs);
0525 plt('slider',Volv1,'set','minmax',en1(2:5),en1(1));
0526 plt('slider',Volv1,'set','position',Hin);
0527 return;
0528 end;
0529
0530 hs = findobj('tag','PltSlider','Val',Hin);
0531 if length(hs) ~= 1 disp('Bad PltSlider handle'); return; end;
0532 hs = get(hs,'use');
0533 fmat = get(hs(4),'use');
0534
0535 accion = varargin{3};
0536 if nargin>3 en0 = varargin{4}; else en0 = ''; end;
0537 if nargin>4 en1 = varargin{5}; else en1 = []; end;
0538 if nargin>5 en2 = varargin{6}; else en2 = []; end;
0539
0540 switch sum(accion)
0541 case 662
0542 ov = get(hs(3),'use'); nv = get(hs(3),'Val');
0543 smax = get(hs(3),'max'); smin = get(hs(3),'min');
0544 dv = nv-ov; sdv = sign(dv);
0545 switch hs(7)
0546 case 4,
0547 v = hs(8)*round(nv/hs(8));
0548 if v==ov v = v + hs(8)*sdv; end;
0549 nv = v;
0550 case 2,
0551 v = round(nv);
0552 if v==ov v = v + sdv; end;
0553 nv = v;
0554 case 5,
0555 paso = exp(log(smax/smin)*abs(dv)/(smax-smin));
0556 if dv>0 nv=ov*paso; elseif dv<0 nv=ov/paso; end;
0557 case 3,
0558 if nv >= get(hs(3),'use')-eps nv=2^nextpow2(nv);
0559 else nv=2^nextpow2(nv/2);
0560 end;
0561 case 6,
0562 pdv = abs(dv)/(smax-smin);
0563 if pdv > .11 nv = hs(8)*round(nv/hs(8));
0564 elseif pdv > .02 nv = ov + hs(8)*sdv;
0565 else nv = ov + sdv;
0566 end;
0567 end;
0568 if nv<smin nv = smin; end;
0569 if nv>smax nv = smax; end;
0570 set(hs(6),'str',plt('ftoa',fmat(2,:),nv));
0571 set(hs(3),'Val',nv,'use',nv);
0572 evalRep(get(hs(5),'use'),{'@VAL',sprintf('%g',nv)});
0573
0574 case 555
0575 nv = s2d(get(hs(6),'str'));
0576 if isempty(nv)
0577 set(hs(6),'str',plt('ftoa',fmat(2,:),get(hs(3),'Val')));
0578 else
0579 switch hs(7)
0580 case 2, nv = round(nv);
0581 case 3, nv = 2 ^ nextpow2(nv/1.414);
0582 case 4, nv=hs(8)*round(nv/hs(8));
0583 end;
0584 minmax = get(hs(6),'use');
0585 nv = min(max(nv,minmax(1)),minmax(2));
0586 Volv1 = nv;
0587 set(hs(6),'str',plt('ftoa',fmat(2,:),nv));
0588 nv = max(min(get(hs(3),'max'),nv),get(hs(3),'min'));
0589 set(hs(3),'Val',nv,'use',nv);
0590 evalRep(get(hs(5),'use'),{'@VAL',sprintf('%g',nv)});
0591 end;
0592
0593 case 320
0594 switch sum(en0)
0595 case 338, Volv1 = sum(get(hs(2),'vis')) == 221;
0596 case 308, Volv1 = sum(get(hs(2),'ena')) == 221;
0597 case 315, Volv1 = hs(2:6);
0598 otherwise Volv1 = s2d(get(hs(6),'str'));
0599 end;
0600 case 332
0601 if isnumeric(en0) en1 = en0; en0 = 'value'; end;
0602 switch sum(en0)
0603 case 541
0604 set(hs(6),'str',num2str(en1));
0605 Volv1 = plt('slider',get(hs(2),'Val'),'CBedit');
0606 case 323
0607 set(hs(6),'str',num2str(en1));
0608 sv = get(hs(5),'use'); set(hs(5),'use','');
0609 Volv1 = plt('slider',get(hs(2),'Val'),'CBedit');
0610 set(hs(5),'use',sv);
0611 case 495, set(hs(2:6),'vis','on')
0612 if isempty(get(hs(2),'str')) set(hs(2),'vis','of'); end;
0613 case 557, set(hs(2:6),'vis','of');
0614 case 527, set(hs([3 6]),'ena','of');
0615 case 465, set(hs([3 6]),'ena','on');
0616 case 885,
0617 a = .1*get(0,'screenp')-9.6;
0618 p = get(gcf,'pos');
0619 if length(en1<3) en1 = [en1 .13]; end;
0620 if en1(1)<1 en1(1) = en1(1)*p(3); end;
0621 if en1(2)<1 en1(2) = en1(2)*p(4); end;
0622 if en1(3)<1 en1(3) = en1(3)*p(3); end;
0623 lmax = 7 + 7*fix(s2d(fmat(3,2:(length(deblank(fmat(3,:)))-1))));
0624 lmin = 7 + 7*fix(s2d(fmat(1,2:(length(deblank(fmat(1,:)))-1))));
0625 if isnan(lmax) lmax = 28; end;
0626 if isnan(lmin) lmin = 14; end;
0627 ha = a + 17; ya = en1(2) - a - 17;
0628 set(hs(2:6),'units','pix',{'pos'},...
0629 {[en1(1:3) 16+a/2];
0630 [en1(1),en1(2)-33,en1(3),17-a-1];
0631 [en1(1),ya,lmin,ha];
0632 [en1(3)+en1(1)-lmax,ya,lmax,ha];
0633 [en1(1)+lmin,ya-1,en1(3)-(lmin+lmax),ha+2]},...
0634 'units','nor');
0635 case 421
0636 hs(7) = en1(1);
0637 if length(en1)>1 hs(8) = en1(2); end;
0638 set(hs(2),'use',hs);
0639 Volv1 = plt('slider',get(hs(2),'Val'),'CBedit');
0640 case 650
0641 if length(en1)<4 en1 = [en1 -1e99 1e99]; end;
0642 set(hs(5),'str',[plt('ftoa',fmat(3,:),en1(2)) ' ']);
0643 set(hs(4),'str',[' ' plt('ftoa',fmat(1,:),en1(1))]);
0644 set(hs(6),'use',en1(3:4));
0645 v = s2d(get(hs(6),'str'));
0646 if ~isempty(en2) v = en2; end;
0647 v = min(max(v,en1(3)),en1(4));
0648 set(hs(6),'str',plt('ftoa',fmat(2,:),v));
0649 set(hs(3),'min',en1(1),'max',en1(2),'Val',min(max(en1(1),v),en1(2)));
0650 Volv1 = s2d(get(hs(6),'str'));
0651 case 512, set(hs(2),'str',en1);
0652 if isempty(en1) set(hs(2),'vis','of'); end;
0653 end;
0654 otherwise disp(sprintf('Invalid Action in plt(''slider''), Action=%s',accion));
0655 end;
0656
0657 case 390
0658 v2 = varargin{2};
0659 if nargin==2 accion='update'; else accion = varargin{3}; end;
0660 if sum(accion) == 436
0661 if nargin<4 grdclr = [.3,.3,.3]; else grdclr = varargin{4}; end;
0662 if nargin<5 erMode = 'xor'; else erMode = varargin{5}; end;
0663 axes(v2); f = findobj(v2,'type','line');
0664 if length(f) f=get(f(1),'ButtonD'); end;
0665 rejaH = line('color',grdclr,'Tag','SkipCur','ButtonD',f,'LineStyle',':','use','grid','erase',erMode);
0666 accion = 'on';
0667 if nargin >= 6 set(rejaH,varargin{6},varargin{7}); end;
0668 if nargin >= 8 set(rejaH,varargin{8},varargin{9}); end;
0669 set(v2,'child',flipud(get(v2,'child')));
0670 else rejaH = findobj(v2,'use','grid'); z = get(rejaH,'z');
0671 Volv1 = length(z);
0672 if Volv1 Volv1 = z(1) | Volv1>=2; end;
0673 end;
0674
0675 switch sum(accion)
0676 case 643, if Volv1 accion='on'; end;
0677 fixMark;
0678 case 642, if Volv1 accion='off'; else accion='on'; end;
0679 end;
0680
0681 x=0; absc=0;
0682 switch sum(accion)
0683 case 221, z=1; Volv1=1;
0684 l = [get(v2,'xli') get(v2,'yli')];
0685 ckY = [l(3) get(v2,'YTICK') l(4)]; liy = length(ckY);
0686 ckX = [l(1) get(v2,'XTICK') l(2)]; lix = length(ckX);
0687 if ckY(2) <= ckY(1) ckY = ckY(2:liy); liy=liy-1; end;
0688 if ckY(liy) <= ckY(liy-1) liy=liy-1; ckY = ckY(1:liy); end;
0689 if ckX(2) <= ckX(1) ckX = ckX(2:lix); lix=lix-1; end;
0690 if ckX(lix) <= ckX(lix-1) lix=lix-1; ckX = ckX(1:lix); end;
0691 t = liy + lix - 4;
0692 if t s = ones(3,1); absc = [1 liy liy]; x = [1 lix lix]; lix=lix-1; liy=liy-1;
0693 z = [0;0;NaN] * ones(1,t); z=z(:);
0694 absc = [s*ckY(2:liy) ckY(absc)'*ones(1,lix-1)]; absc=absc(:);
0695 x = [ckX(x)'*ones(1,liy-1) s*ckX(2:lix)]; x=x(:);
0696 end;
0697 case 315, z=0; Volv1=0;
0698 end;
0699 set(rejaH,'z',z,'y',absc,'x',x);
0700
0701 case 436
0702 accion = varargin{2};
0703 if nargin > 2 en0 = varargin{3};
0704 if nargin > 3 en1 = varargin{4}; end;
0705 end;
0706 switch sum(accion)
0707 case 436
0708 copia(12)= en0;
0709 set(0,'units','pix'); sz = get(0,'screens');
0710 szw = sz(3) - 350 - 4;
0711 ppos = get(gcf,'pos');
0712 if ppos(4)<1 sp = sz(3:4); ppos = ppos .* [sp sp]; end;
0713 xp = min(ppos(1)+ppos(3)+6,szw);
0714 yp = ppos(2)+ppos(4)-105-30*length(findobj('type','fig','use',gcf));
0715 if nargin ==4 renderer = en1; else renderer = '-painters'; end;
0716 copia(1)=figure('menu','none','number','off','Back','off','resize','off','pos',[xp yp 350 105],'color',[0,.4,.4],'name','Hardcopy','use',gcf);
0717 foobar = 0;
0718 if exist('foobar')
0719 cpath = feval('which','plt.m');
0720 else cpath = GetExe;
0721 end;
0722 filen = [fileparts(cpath) filesep 'pltHcpy.mat'];
0723 f = fopen(filen);
0724 if f>=0 fclose(f); load(filen);
0725 else
0726 z = [0 0]; t = z+1; w = [0 1];
0727 pS1=[z;z;[2 1];w;t;w;t;z;t;w;z];
0728 pS2 = 'nofile.000';
0729 end;
0730 copia(3) = uicontrol('sty','pop','str',['Win Meta|Bit Map|HPGL|LaserJet IIp|Post Script|Encaps PS|Windows'],...
0731 'call','plt(''hcpy'',''ModePUcb'');');
0732 copia(5) = uicontrol('sty','radio','str','color','call','plt(''hcpy'',''rbg1'',''C'');');
0733 copia(4) = uicontrol('sty','radio','str','B&W','call','plt(''hcpy'',''rbg1'',''BW'');');
0734 copia(6) = uicontrol('sty','radio','str','Clip Board','call','plt(''hcpy'',''rbg2'',''cb'');');
0735 copia(8) = uicontrol('sty','radio','str','Device','call','plt(''hcpy'',''rbg2'',''dev'');');
0736 copia(7) = uicontrol('sty','radio','str','File','call','plt(''hcpy'',''rbg2'',''file'');');
0737 copia(11) = uicontrol('sty','text','str',pS2,'horiz','left');
0738 copia(10) = uicontrol('sty','text','str', 'Path/File:','horiz','left');
0739 copia(9) = uicontrol('str','Print','call','plt(''hcpy'',''print'');','use',renderer);
0740 copia(2) = uicontrol('str','Select File','call',['plt(''hcpy'',''OpenPBcb'');']);
0741 cncl = uicontrol('str','Cancel','call','close(gcf)');
0742 h1 = copia([3 5 4 6 8 7]);
0743 h2 = copia([11 10]);
0744 h3 = [copia([9 2]) cncl];
0745 set(h1,{'Val'},{pS1(3,1); pS1(5,1); pS1(4,1); pS1(6,1); pS1(8,1); pS1(7,1)});
0746 set([h1 h2],'backg',[.8,.8,.9],'foreg','black');
0747 set([h1 h2 h3],{'pos'},{[115 80 100 15]; [ 10 85 65 15]; [10 70 65 15]; [245 85 95 15];
0748 [245 55 95 15]; [245 70 95 15]; [10 35 330 15]; [ 10 50 65 15];
0749 [110 5 55 20]; [ 10 5 85 20]; [180 5 55 20]});
0750
0751 for kk=1+1:12-1
0752 if pS1(kk,2)==1 set(copia(kk),'ena','on'); else set(copia(kk),'ena','of'); end;
0753 end;
0754
0755 if get(copia(8),'Val') set(copia(2),'str','Select Dev');
0756 else set(copia(2),'str','Select File');
0757 end;
0758 set(copia(1),'vis','on');
0759 case 364
0760 switch sum(en0)
0761 case 67, set(copia(5),'Val',1); set(copia(4),'Val',0);
0762 case 153, set(copia(4),'Val',1); set(copia(5),'Val',0);
0763 end;
0764 case 365
0765 switch sum(en0)
0766 case 319, set(copia(6),'Val',0); set(copia(7),'Val',0);
0767 set(copia(9),'ena','on'); set(copia(11),'ena','of');
0768 set(copia(8),'Val',1); set(copia(2),'str','Select Dev','ena','on');
0769 case 197, set(copia(6),'Val',1); set(copia(7),'Val',0);
0770 set(copia(9),'ena','on'); set(copia(11),'ena','of');
0771 set(copia(8),'Val',0); set(copia(2),'ena','of');
0772 case 416, set(copia(6),'Val',0); set(copia(7),'Val',1);
0773 set(copia(8),'Val',0); set(copia(2),'str','Select File','ena','on');
0774 cher = get(copia(11),'str');
0775 if length(cher)<5 cher='none'; set(copia(11),'str',cher); end;
0776 if strcmp(cher(1:4),'none') set(copia(9),'ena','of'); end;
0777 set(copia(11),'ena','on');
0778 end;
0779 case 751
0780 en = [1 1 0 1 1; 1 1 0 1 0; 1 1 0 1 1; 1 1 0 0 1; 0 1 0 1 1; 0 1 0 1 1; 0 0 1 1 1];
0781 va = [0 1 0 1 0; 0 1 0 1 0; 0 1 0 0 1; 0 1 0 0 1; 0 1 0 1 0; 0 1 0 1 0; 0 0 1 1 0];
0782 s = get(copia(3),'Val');
0783 ipo=reshape('WMFBMPHGLJETPS EPSxxxxxx',3,8)';
0784 if s==7 set(copia(2),'str','Select Dev', 'ena','on'); set(copia(11),'ena','of');
0785 else set(copia(2),'str','Select File','ena','on'); set(copia(11),'ena','on');
0786 cher = get(copia(11),'str');
0787 if length(cher)<5 cher='none'; set(copia(11),'str',cher); end;
0788 nfn=length(cher);
0789 if cher(nfn-3) == '.'
0790 set(copia(11),'str',[cher(1:nfn-3) ipo(s,:)]);
0791 else set(copia(11),'str',[cher ipo(s,:)]);
0792 end;
0793 end;
0794 ena = {'off' 'on'};
0795 set(copia(6),'ena',ena{1+en(s,1)},'Val',va(s,1));
0796 set(copia(7), 'ena',ena{1+en(s,2)},'Val',va(s,2));
0797 set(copia(8), 'ena',ena{1+en(s,3)},'Val',va(s,3));
0798 set(copia(5), 'ena',ena{1+en(s,4)},'Val',va(s,4));
0799 set(copia(4), 'ena',ena{1+en(s,5)},'Val',va(s,5));
0800 case 745
0801 if strcmp('Select File',get(copia(2),'str'))
0802 ipo=reshape('WMFBMPHGLJETPS EPSxxxxxx',3,8)';
0803 [cher,pathN]= uiputfile(['*.',ipo(get(copia(3),'Val'),:)],'Open (new) File');
0804 if cher
0805 fi = cher;
0806 if isempty(findstr(',',fi)) fi = [fi '.' ipo(get(copia(3),'Val'),:)]; end;
0807 set(copia(11),'str',[pathN fi]); set(copia(9),'ena','on');
0808 end;
0809 elseif strcmp('Select Dev',get(copia(2),'str')) print -dsetup
0810 else disp('Invalid OpenPBcb string');
0811 end;
0812 case 557
0813 trvS= get(copia(12),'invert');
0814 set(copia(12),'invert','off');
0815 figure(copia(12)); drawnow;
0816 PrintMode = get(copia(3),'Val');
0817 colorFlg = get(copia(5),'Val');
0818 nirS = sprintf('print -f%d',copia(12));
0819 renderer = get(copia(9),'use');
0820 opcion={[' ' renderer ' -dmeta '];' -dbitmap ';' -dhpgl ';' -dljet2p '};
0821 if colorFlg opcion = [opcion; {' -dpsc ';' -depsc ';' -dwinc '}];
0822 else opcion = [opcion; {' -dps ' ;' -deps ';' -dwin '}];
0823 end;
0824 nirS=[nirS opcion{PrintMode,:} ' '];
0825 if get(copia(7),'Val')==1
0826 PathFilen = get(copia(11),'str'); nirS=[nirS '''' PathFilen ''''];
0827 end;
0828 nirS = [nirS ' -noui']; axh = []; axh = findobj(copia(12),'type','axes'); nvx = length(axh);
0829 if ~colorFlg
0830 figC=get(copia(12),'color');
0831 nino = []; axCol = zeros(nvx,3); imar = zeros(nvx,1);
0832 for kk=1:nvx
0833 x = get(axh(kk),'color');
0834 if strcmp('none',x) imar(kk) = 1; else axCol(kk,:) = x; end;
0835 nino = [nino; get(axh(kk),'child')];
0836 xCol(kk,:) = get(axh(kk),'xcol'); yCol(kk,:) = get(axh(kk),'ycol');
0837 tCol(kk,:) = get(get(axh(kk),'title'),'color');
0838 if xCol(kk,:) == figC imar(kk) = imar(kk) + 2; end;
0839 end;
0840 nnino = length(nino);
0841 for kk=1:nnino
0842 if sum(get(nino(kk),'type'))==528 kidCol(kk,:) = get(nino(kk),'facecolor');
0843 set(nino(kk),'facecolor',[.25 .25 .25]);
0844 else kidCol(kk,:) = get(nino(kk),'color'); set(nino(kk),'color','black');
0845 end;
0846 end;
0847 set(copia(12),'color','white');
0848 for kk= 1:nvx
0849 if imar(kk)==1 | imar(kk)==3
0850 else set(axh(kk),'color','white');
0851 end;
0852 if imar(kk)>=2 set(axh(kk),'xcol','white','ycol','white' );
0853 else set(axh(kk),'xcol','black','ycol','black' );
0854 end;
0855 end;
0856 for kk=1:nvx
0857 if get(get(axh(kk),'title'),'color')==figC set(get(axh(kk),'title'),'color','white');
0858 else set(get(axh(kk),'title'),'color','black');
0859 end;
0860 if imar(kk) >=2
0861 set(get(axh(kk),'xlabel'),'color','white'); set(get(axh(kk),'ylabel'),'color','white');
0862 else set(get(axh(kk),'xlabel'),'color','black'); set(get(axh(kk),'ylabel'),'color','black');
0863 end;
0864 end;
0865 end;
0866 set(copia(1),'pointer','watch'); drawnow; pause(1);
0867 if PrintMode == 2
0868 set(copia(1),'vis','of');
0869 refresh
0870 eval(nirS);
0871 set(copia(1),'vis','on');
0872 else drawnow discard; eval(nirS);
0873 end;
0874 if ~colorFlg & (PrintMode ~=4 | PrintMode ~=7)
0875 set(copia(12),'color',figC);
0876 for kk=1:nvx
0877 if ~rem(imar(kk),2) set(axh(kk),'color',axCol(kk,:)); end;
0878 set(axh(kk),'xcol',xCol(kk,:)); set(axh(kk),'ycol',yCol(kk,:));
0879 set(get(axh(kk),'title'),'color',tCol(kk,:));
0880 end;
0881 for kk=1:nnino
0882 if sum(get(nino(kk),'type'))==528 set(nino(kk),'facecolor',kidCol(kk,:));
0883 else set(nino(kk),'color',kidCol(kk,:));
0884 end;
0885 end;
0886 if PrintMode==2 drawnow; else drawnow discard; end;
0887 end;
0888 pS1=zeros(12-1,2);
0889 for kk=1+1:12-1
0890 pS1(kk,1) = get(copia(kk),'Val');
0891 if sum(get(copia(kk),'ena'))==221 pS1(kk,2)=1; end;
0892 end;
0893 pS2=get(copia(11),'str');
0894 foobar = 0;
0895 if exist('foobar')
0896 cpath = feval('which','plt.m');
0897 else cpath = GetExe;
0898 end;
0899 save([fileparts(cpath) filesep 'pltHcpy.mat'],'pS1','pS2');
0900 close(copia(1));
0901 set(copia(12),'invert',trvS);
0902 clear copia
0903 otherwise disp([accion ' invalid Action in plt(hcpy)']);
0904 end;
0905
0906 case 670
0907
0908 if nargin<3 disp('Not enough arguments plt(''cursor'',...)'); return; end;
0909 cador = varargin{2};
0910 accion = varargin{3};
0911 if nargin > 3
0912 en0 = varargin{4};
0913 if nargin > 4
0914 en1 = varargin{5};
0915 if nargin > 5
0916 en2 = varargin{6}; if iscell(en2) en2 = char(en2); end;
0917 if nargin > 6
0918 en3 = varargin{7};
0919 if nargin > 7
0920 en4 = varargin{8};
0921 if nargin > 8
0922 en5 = varargin{9}; if iscell(en5) en5 = char(en5); end;
0923 if nargin > 9
0924 en6 = varargin{10};
0925 if nargin > 10
0926 en7 = varargin{11};
0927 if nargin > 11 en8 = varargin{12}; end;
0928 end;
0929 end;
0930 end;
0931 end;
0932 end;
0933 end;
0934 end;
0935 end;
0936
0937 CurPri = getappdata(0,'CurMain');
0938 sact = sum(accion);
0939 if sact ~= 436
0940 if isempty(cador) return; end;
0941 Hc = get(CurPri(cador),'use');
0942 v2 = Hc(13); ax2 = Hc(14);
0943 aconex = 0;
0944 if ax2
0945 if sum(get(ax2,'vis')) == 315 ax2=0;
0946 else aconex = [get(get(ax2,'ylabel'),'str') ' '];
0947 aconex = aconex(1)~=92 | aconex(2) ~= 'd';
0948 end;
0949 end;
0950 nw1 = Hc(4); nw2 = Hc(6);
0951 tm = get(nw1,'use');
0952 actv = tm(4);
0953 iact = 14 + actv;
0954 hact = Hc(iact);
0955 LMda = [get(v2,'xli') get(v2,'yli')];
0956 xyli = LMda;
0957 if get(hact,'par')==ax2 xyli(3:4) = get(ax2,'yli'); end;
0958 DuaC = getappdata(v2,'DualCur');
0959 end;
0960 nargin2=nargin;
0961 switch sact
0962 case 436
0963 v2 = cador(1);
0964 DuaC = getappdata(v2,'DualCur');
0965 if isempty(DuaC) DuaC = 0; setappdata(v2,'DualCur',0); end;
0966 Hc(13) = v2;
0967 if length(cador)==2 ax2 = cador(2); else ax2 = 0; end;
0968 Hc(14) = ax2;
0969 hf = get(v2,'par');
0970 if nargin2>=10 vis=en6; else vis = 'on'; end;
0971 Cn = length(CurPri);
0972 f = find(~CurPri);
0973 if length(f) cador = f(1);
0974 else CurPri = [CurPri 0]; cador = Cn+1;
0975 end;
0976 if cador>200 disp('Warning: Clear actions missing for 200 cursor inits'); end;
0977 Volv1 = cador;
0978 rasHT = sprintf('plt(''cursor'',%d,',cador);
0979 hRastro = getappdata(v2,'Lhandles');
0980 if isempty(hRastro)
0981 hRastro = flipud(findobj(v2,'type','line'));
0982 end;
0983 fct = findobj(hRastro,'Tag','SkipCur');
0984 if length(fct) [c kk] = setdiff(hRastro,fct);
0985 c = sortrows([c kk],2);
0986 hRastro = c(:,1);
0987 end;
0988 axes(v2);
0989 if isempty(en1) en1 = [.7 .7 .7; 0 0 0; 1 1 .5; 1 0 0; 0 0 0]; end;
0990 trk = ~sum(en1(2,:));
0991 if length(hRastro)
0992 en1n = length(en1(:,1));
0993 cHilo = length(hRastro);
0994 cli4 = cHilo + 4;
0995 if en1n < cli4
0996 en1 = en1(min(1:cli4,en1n*ones(1,cli4)),:);
0997 end;
0998 en3n = length(en3);
0999 if en3n<cHilo
1000 en3 = en3(min(1:cHilo,en3n*ones(1,cHilo)));
1001 end;
1002 en1n = length(en1(:,1));
1003 objectoC = en1(5:en1n,:);
1004 tact = 0;
1005 if ax2 hLines2 = findobj(ax2,'type','line'); else hLines2 = 0; end;
1006 for kk=1:cHilo
1007 hi = hRastro(kk);
1008 argo = [get(hi,'x'); get(hi,'y')];
1009 if sum(objectoC(kk,:)) curColor = objectoC(kk,:);
1010 else curColor = get(hi,'color');
1011 end;
1012 Hc(14+kk)=line('x',argo(1,1),'y',argo(2,1),'erase','xor','color',curColor,...
1013 'clipping','on','vis',vis,'use',[hi trk]);
1014 set(Hc(14+kk),'Marker',en3(kk),'MarkerSize',en4);
1015 set(hi,'ButtonD',sprintf('%s''lineCB'',%d);',rasHT,kk));
1016 if ~tact & (sum(get(hi,'vis'))==221) tact = kk; end;
1017 if length(find(hi==hLines2)) set(Hc(14+kk),'par',ax2); end;
1018 end;
1019 else disp('no lines to attach cursors to')
1020 end;
1021 if max(max(en0))>2 unitt = 'Pixels'; else unitt = 'Normal'; end;
1022 Sfuente = (196-get(0,'screenpix'))/10;
1023 for kk=2:3
1024 if kk==2 cordo = '''x'');'; else cordo = '''y'');'; end;
1025 cordo= [rasHT '''scaleAxis'',' cordo];
1026 if isempty(en2) en2 = ['x';'y']; end;
1027 Hc(kk) = uicontrol(hf,'Style','text','fontsi',Sfuente,'vis',vis,'str',deblank(en2(kk-2+1,:)),...
1028 'Units',unitt,'pos',en0(kk-1,:),'backg',en1(1,:),'horiz','cent','ButtonD',cordo,'call',cordo);
1029 end;
1030 for kk=4:7
1031 if trk==1 objectoC = [1 1 1]; else objectoC = en1(2,:); end;
1032 cordo = sprintf('%s''editCB'',%d);',rasHT,kk-4);
1033 if kk==5 | kk==7 objectoC=get(gcf,'color'); end;
1034 Hc(kk) = uicontrol(hf,'Style','edit','fontsi',Sfuente,'vis',vis,'str',' ','Units',unitt,'pos',en0(kk-1,:),...
1035 'foreg',get(v2,'color'),'backg',objectoC,'horiz','left','call',cordo);
1036 end;
1037 if ~DuaC set(Hc(7),'vis','of'); end;
1038 set(Hc(5),'vis','of');
1039 nw1 = Hc(4); nw2 = Hc(6);
1040 ih = [8 9 10]; c = [173 175 68]; u = {-inf inf ''};
1041 cbs = {'''peakval'',0);', '''peakval'',1);', '''markCB'','''');'};
1042 for k = 1:3
1043 liy = ih(k);
1044 Hc(liy) = uicontrol(hf,'Units',unitt,'pos',en0(liy-1,:),'vis',vis,'horiz','cent',...
1045 'str',char(c(k)),'fontname','symbol','fontw','bol',...
1046 'call',[rasHT cbs{k}],'use',u{k});
1047 end;
1048 set(Hc(8), 'ui',uicontextmenu('call',[rasHT '''peakval'',2);']));
1049 set(Hc(9),'ui',uicontextmenu('call',[rasHT '''peakval'',3);']));
1050 set(Hc(10),'fontsi',12,'ena','of');
1051 Hc(12) = line('x',[],'y',[],'erase','xor','color',en1(4,:),'vis','of');
1052 set(Hc(12),'Marker','+','MarkerSize',5*en4,'tag','DeltaC');
1053 if nargin2<9 en5 = ''; end;
1054 if isempty(en5) en5 = ['%7w';'%7w']; end;
1055 set(Hc(3),'use',en5);
1056 if length(en0(:,1)) > 9
1057 uicontrol(hf,'style','slider','Units',unitt,'pos',en0(10,:),...
1058 'backg',[.3 .3 .3],'Min',0,'Max',1000,'Val',500,'use',500,...
1059 'vis',vis,'call',[rasHT '''xslider'');'],'tag','xslider');
1060 end;
1061 set(get(v2,'xlabel'),'ButtonD',[rasHT '''xincr'');']);
1062 kk = [rasHT '''axisCB'');'];
1063 Hc(11) = line('x',[],'y',[],'erase','xor','vis','of','color',en1(3,:),'ButtonD',kk);
1064 set([hf v2],'ButtonD',kk);
1065 if nargin2>=11 & length(en7) jst1 = en7; else jst1 = -1; end;
1066 if nargin2>=12 set(Hc(5),'use',en8); else set(Hc(5),'use',''); end;
1067 tm = zeros(1,8);
1068 if ax2 set(ax2,'ButtonD',[rasHT '''AxisCBaux'');']); end;
1069 tm(5) = jst1;
1070 tm(4) = max(1,tact);
1071 set(nw1,'use',tm);
1072 set(Hc(7),'use','','Tag','');
1073 set(Hc(2),'use',Hc);
1074 CurPri(cador) = Hc(2);
1075 setappdata(0,'CurMain',CurPri);
1076
1077 case 719
1078 if nargin<8
1079 en4 = [];
1080 if nargin<7
1081 en3 = [];
1082 if nargin<5 en1 = []; end;
1083 end;
1084 end;
1085 if isempty(en1)
1086 RastH = get(hact,'use');
1087 x = get(RastH(1),'x'); absc = get(RastH(1),'y');
1088 if en0<1 en0 = tm(1); end;
1089 lix = length(x);
1090 if en0>lix lix = round(lix/2); en1 = x(lix); en2 = absc(lix);
1091 else en1 = x(en0); en2 = absc(en0);
1092 end;
1093 end;
1094 if isempty(en3) en3 = sum(get(Hc(12),'vis'))==221; end;
1095
1096 lmx = xyli(1:2); ylim = xyli(3:4);
1097 xd = 1.01 * (en1-lmx);
1098 yd = 1.01 * (en2-ylim);
1099 if xd(1)<=0 lmx = lmx + xd(1); elseif xd(2)>=0 lmx = lmx+xd(2); end;
1100 if yd(1)<=0 ylim = ylim + yd(1); elseif yd(2)>=0 ylim = ylim+yd(2); end;
1101 if ~isequal(xyli,[lmx ylim])
1102 set(v2,'xli',lmx);
1103 if ax2 set(ax2,'xli',lmx); end;
1104 set(get(hact,'par'),'yli',ylim);
1105 if length(findobj(v2,'use','grid')) plt('grid',v2,'update'); end;
1106 evalQ(get(Hc(5),'use'));
1107 end;
1108
1109 set(hact,'y',en2,'x',en1);
1110 tipo = get(Hc(3),'use');
1111 if length(en4)
1112 fr = repmat(max(en4.*[.9 1 .5])<=.5,1,3);
1113 set([nw1 nw2],'backg',en4,'foreg',fr);
1114 allC = Hc(14+1:end);
1115 if DuaC allC(DuaC) = []; end;
1116 set(allC,'vis','of');
1117 set(hact,'vis','on');
1118 if ax2 | en3 set(Hc(7),'backg',en4,'foreg',fr); end;
1119 set(Hc([2:3]),'ena','inact'); set(Hc(10),'ena','on');
1120 end;
1121 set(nw2,'str',plt('ftoa',tipo(2,:),en2));
1122 set(nw1,'str',plt('ftoa',tipo(1,:),en1));
1123 if en3
1124 bk = get(nw1,'backg');
1125 fr = get(nw1,'foreg');
1126 set(Hc(7),'str',plt('ftoa',tipo(2,:),en2-get(Hc(12),'y')),'backg',bk,'foreg',fr,'vis','on');
1127 set(Hc(5),'str',plt('ftoa',tipo(1,:),en1-get(Hc(12),'x')),'backg',bk,'foreg',fr,'vis','on');
1128 end;
1129 tm([1 2 3]) = [en0 en1 en2];
1130 set(nw1,'use',tm);
1131 s = get(Hc(7),'Tag');
1132 if length(s) eval(s); end;
1133 sx = getappdata(v2,'xstr'); sy = getappdata(v2,'ystr'); s = [sx sy];
1134 rep1 = {'@XVAL','real(@XY)',...
1135 '@YVAL','imag(@XY)',...
1136 '@XY', 'plt("cursor",@CID,"get","position")',...
1137 '@IDX', 'plt2nd({"cursor",@CID,"get","position"})',...
1138 '@LNUM','plt("cursor",@CID,"get","activeLine")',...
1139 '@HAND','plt2nd({"cursor",@CID,"get","activeLine"})',...
1140 '@XU' ,['get8192(' int2str(8192*sx) ',"user")'],...
1141 '@YU' ,['get8192(' int2str(8192*sy) ',"user")'],...
1142 '@CID', sprintf('%d',cador)};
1143 for k=1:length(s)
1144 set(s(k),'str',evalRep2(getappdata(s(k),'evl'),rep1));
1145 end;
1146 if length(getappdata(v2,'moveCBext')) | length(find(v2==findobj(gcf,'type','axes')))
1147 s = get(Hc(7),'use');
1148 if length(s) evalRep(s,rep1); end;
1149 end;
1150
1151 case 632
1152 tipo = get(Hc(3),'use');
1153 kvs = tm(1);
1154 RastH = get(Hc(14+DuaC),'use'); lh1 = RastH(1);
1155 argo = [get(lh1,'x'); get(lh1,'y')];
1156 tm(6) = argo(2,kvs); set(nw1,'use',tm);
1157 largo = length(argo(1,:)); if kvs>largo kvs=largo; end;
1158 set(Hc(14+DuaC),'x', max(xyli(1),min(xyli(2),argo(1,kvs))),...
1159 'y', max(xyli(3),min(xyli(4),argo(2,kvs))));
1160 if sum(get(Hc(12),'vis'))==221 return; end;
1161 if RastH(2)==1
1162 set(Hc(7),'backg',get(lh1,'color'));
1163 set(Hc(5),'vis','of');
1164 end;
1165 set(Hc(7),'str',plt('ftoa',tipo(2,:),argo(2,kvs)));
1166 case 472
1167 p0 = getappdata(get(v2,'xlab'),'OldCur');
1168 sc = get(v2,'yscale'); liny = sc(2)=='i';
1169 if ischar(en0)
1170 Cpunta = get(ax2,'curre'); cy = Cpunta(1,2);
1171 absc = get(ax2,'yli');
1172 if liny absc = absc + p0(2) - cy;
1173 else absc = absc * p0(2) / cy;
1174 end;
1175 set(ax2,'yli',absc);
1176 else
1177 Cpunta = get(v2,'curre');
1178 cx = Cpunta(1,1); cy = Cpunta(1,2);
1179 if en0<1 x = LMda(1:2);
1180 sc = get(v2,'xscale');
1181 if sc(2)=='i' x = x + p0(1) - cx;
1182 else x = x * p0(1) / cx;
1183 end;
1184 if ax2 axb = [v2 ax2]; else axb = v2; end;
1185 set(axb,'xli',x);
1186 end;
1187 if en0 absc = LMda(3:4);
1188 if liny yi = p0(2) - cy; absc = absc + yi;
1189 else yi = p0(2) / cy; absc = absc * yi;
1190 end;
1191 set(v2,'yli',absc);
1192 if aconex
1193 yr = get(ax2,'yli');
1194 if liny yr = yr + yi * diff(yr)/diff(absc);
1195 else yr = yr * (yr(2)/yr(1))^(log(yi)/log(absc(2)/absc(1)));
1196 end;
1197 set(ax2,'yli',yr);
1198 end;
1199 end;
1200 end;
1201 fixMark;
1202 case 606
1203 p0 = getappdata(get(v2,'xlab'),'OldCur');
1204 if ischar(en0)
1205 Cpunta = get(ax2,'curre');
1206 absc = get(ax2,'yli'); y0 = absc(1); y1 = absc(2);
1207 cy = Cpunta(1,2)-y0; if ~cy cy=1e-06; end;
1208 set(ax2,'yli',[y0 y0 + abs((p0(2)-y0)*(y1-y0)/cy)]);
1209 else
1210 Cpunta = get(v2,'curre');
1211 if en0<1 x0 = LMda(1); x1 = LMda(2);
1212 cx = Cpunta(1,1)-x0; if ~cx cx=1e-06; end;
1213 if ax2 axb = [v2 ax2]; else axb = v2; end;
1214 set(axb,'xli',[x0 x0 + abs((p0(1)-x0)*(x1-x0)/cx)]);
1215 end;
1216 if en0 y0 = LMda(3); y1 = LMda(4); dy = y1-y0;
1217 cy = Cpunta(1,2)-y0; if ~cy cy=1e-06; end;
1218 cy = dy/cy; p2 = p0(2)-y0;
1219 set(v2,'yli',[y0 y0 + abs(p2*cy)]);
1220 if aconex
1221 sc = get(v2,'yscale');
1222 if sc(2)=='i'
1223 absc = get(ax2,'yli'); y0 = absc(1); y1 = absc(2);
1224 p2 = (y1-y0) * p2 / dy;
1225 set(ax2,'yli',[y0 y0 + abs(p2*cy)]);
1226 else
1227 yr = get(ax2,'yli'); yr0 = yr(1); yr1 = yr(2);
1228 Cpunta = get(ax2,'curre');
1229 cy = Cpunta(1,2)-yr0; if ~cy cy=1e-06; end;
1230 p0 = yr0 * exp(log(p0(2)/y0) * log(yr1/yr0) / log(y1/y0));
1231 set(ax2,'yli',[yr0 yr0 + abs((p0-yr0)*(yr1-yr0)/cy)]);
1232 end;
1233 end;
1234 end;
1235 end;
1236 fixMark;
1237 case 662
1238 Cpunta = get(v2,'curre');
1239 urX = max(LMda(1),min(LMda(2),Cpunta(1,1))); yCur = max(LMda(3),min(LMda(4),Cpunta(1,2)));
1240 Cpunta = get(Hc(11),'use');
1241 xAntiq = Cpunta(1); yAntiq = Cpunta(2);
1242 if sum(get(v2,'yscale')) == 322
1243 vz = abs(log(LMda(3)/LMda(4))) < 50 * abs(log(yAntiq/yCur));
1244 else vz = diff(LMda(3:4)) < 50 * abs(yAntiq-yCur);
1245 end;
1246 if vz
1247 if sum(get(v2,'xscale')) == 322
1248 vz = abs(log((.0001*LMda(2)+LMda(1))/LMda(2))) < 50 * abs(log(xAntiq/urX));
1249 else vz = diff(LMda(1:2)) < 50 * abs(xAntiq-urX);
1250 end;
1251 end;
1252 if vz
1253 set(Hc(11),'x',[xAntiq urX urX xAntiq xAntiq],'y',[yAntiq yAntiq yCur yCur yAntiq]);
1254 tipo=get(Hc(3),'use');
1255 if sum(get(Hc(11),'vis')) == 315
1256 set(Hc(11),'vis','on');
1257 set(nw2,'str',plt('ftoa',tipo(2,:),yAntiq));
1258 set(nw1,'str',plt('ftoa',tipo(1,:),xAntiq));
1259 set(Hc([5 7 4 6]),'ena','on');
1260 set(Hc(10),'ena','of');
1261 end;
1262 bk = get(nw1,'backg');
1263 fr = get(nw1,'foreg');
1264 set(Hc(7),'str',plt('ftoa',tipo(2,:),yCur),'backg',bk,'foreg',fr,'vis','on');
1265 set(Hc(5),'str',plt('ftoa',tipo(1,:),urX),'backg',bk,'foreg',fr,'vis','on');
1266 end;
1267 case {570, 557},
1268 Mtipo = sum(get(gcf,'SelectionT'));
1269 if (sum(get(Hc(11),'vis'))==315) & ~tm(7) & ~tm(8)
1270 rasHT = sprintf('plt(''cursor'',%d,',cador);
1271 smv = '';
1272 PareMovi = 'set(gcf,{''WindowButtonMotionFcn'',''WindowButtonUpFcn''},{'''',''''});';
1273 Cpunta = get(v2,'curre'); cx = Cpunta(1,1); cy = Cpunta(1,2);
1274 if cx<LMda(1) | cx>LMda(2) dragy = '1);';
1275 elseif cy<LMda(3) | cy>LMda(4) dragy = '0);';
1276 else dragy = '-1);';
1277 end;
1278 urX = max(LMda(1),min(LMda(2),cx));
1279 dxy = diff(LMda);
1280 if isempty(getappdata(gcf,'NoEdit')) & urX-cx > .08*dxy(1)
1281 switch Mtipo
1282 case 649, plt('click','EDIT','1');
1283 case 321, plt('click','EDIT','2');
1284 end;
1285 return;
1286 end;
1287 switch Mtipo
1288 case 649
1289 yCur = max(LMda(3),min(LMda(4),cy));
1290 if length(get(hact,'ButtonD'))
1291 setappdata(hact,'ilast',getappdata(hact,'i'));
1292 plt('click','EDIT','0');
1293 end;
1294 ovt = 0;
1295 if sact==570
1296 nargin2 = 4;
1297 RastH = get(hact,'use');
1298 if sum(get(RastH(1),'vis')) ~= 221
1299 for kk=14+1:length(Hc)
1300 RastH = get(Hc(kk),'use');
1301 if sum(get(RastH(1),'vis')) == 221 break; end;
1302 end;
1303 actv = kk-14;
1304 end;
1305 en0 = actv;
1306 if ax2
1307 ylm = get(ax2,'yli'); dylm = diff(ylm);
1308 cvert = (cy - LMda(3)) / dxy(3);
1309 mdst = 1e+99;
1310 idst = 0;
1311 for kk=14+1:length(Hc)
1312 if get(Hc(kk),'par') ~= ax2 continue; end;
1313 RastH = get(Hc(kk),'use'); RastH = RastH(1);
1314 if sum(get(RastH,'vis')) == 315 continue; end;
1315 x = get(RastH,'x'); absc = get(RastH,'y');
1316 if length(x)>999 | all(diff(x)>0)
1317 [toss,j] = min(abs(urX-x));
1318 dvert = (absc(j) - ylm(1)) / dylm;
1319 acv = abs(cvert-dvert);
1320 else
1321 acv = min(abs((x-urX)/dxy(1)) + abs((absc-ylm(1))/dylm - cvert));
1322 end;
1323 if acv < mdst idst = kk; mdst = acv; end;
1324 end;
1325 if mdst < .02
1326 ovt = 1;
1327 ii = idst-14;
1328 if ii ~= DuaC en0 = ii; end;
1329 end;
1330 end;
1331 end;
1332 RastH = get(Hc(14+en0),'use');
1333 x = get(RastH(1),'x'); absc = get(RastH(1),'y');
1334 if nargin2==4
1335 set(Hc(8), 'use',-inf);
1336 set(Hc(9),'use',inf);
1337 if tm(5)==-1
1338 df = diff(x);
1339 jst1 = all(df>0) | all(df<0);
1340 else jst1 = tm(5);
1341 end;
1342 if RastH(2)==1 clRastro = get(RastH(1),'color');
1343 else clRastro = get(nw2,'backg');
1344 end;
1345 indic = sum(get(Hc(12),'vis'))==221;
1346 else clRastro=[]; jst1=en1; indic=en2;
1347 end;
1348 if jst1 [junk,kvs] = min(abs(urX-x));
1349 elseif get(RastH(1),'par')==ax2
1350 ylm = get(ax2,'yli'); dylm = diff(ylm);
1351 cvert = (cy - LMda(3)) / dxy(3);
1352 [toss,kvs] = min(abs((x-urX)/dxy(1)) + abs((absc-ylm(1))/dylm - cvert));
1353 else [toss,kvs] = min(abs((x-urX)/dxy(1)) + abs(yCur-absc)/dxy(3));
1354 end;
1355 actv = en0; tm(4) = actv;
1356 iact = 14 + actv;
1357 hact = Hc(iact);
1358 set(nw1,'use',tm);
1359 plt('cursor',cador,'mainCur',kvs,x(kvs),absc(kvs),indic,clRastro);
1360 if DuaC plt('cursor',cador,'auxCur'); end;
1361 if (sact==557) | ovt
1362 if nargin2==4
1363 smv = sprintf('%s''lineCB'',%d,%d,%d);',rasHT,en0,jst1,indic);
1364 end;
1365 else setappdata(get(v2,'xlab'),'OldCur',[cx cy LMda]);
1366 PareMovi = [rasHT '''svHist'');' PareMovi];
1367 smv = [rasHT '''panAX'',' dragy];
1368 end;
1369 case 321
1370 setappdata(get(v2,'xlab'),'OldCur',[cx cy LMda]);
1371 PareMovi = [rasHT '''svHist'');' PareMovi];
1372 smv = [rasHT '''zoomAX'',' dragy];
1373 otherwise,
1374 set(Hc(11),'use',[max(LMda(1),min(LMda(2),cx)) max(LMda(3),min(LMda(4),cy))]);
1375 smv = [rasHT '''expbox'');'];
1376 end;
1377 if length(smv) set(gcf,'WindowButtonMotionFcn',smv,'WindowButtonUpFcn',PareMovi); end;
1378 elseif (sum(get(Hc(11),'vis'))==221) | tm(7) | tm(8)
1379 switch Mtipo
1380 case 649, plt('cursor',cador,'scale','new');
1381 case 321, plt('cursor',cador,'restore');
1382 end;
1383 tm([7 8]) = 0; set(nw1,'use',tm);
1384 end;
1385 case 872
1386 rasHT = sprintf('plt(''cursor'',%d,',cador);
1387 Cpunta = get(ax2,'curre'); setappdata(get(v2,'xlab'),'OldCur',[Cpunta(1,1) Cpunta(1,2)]);
1388 switch sum(get(gcf,'SelectionT'));
1389 case 321, smv = [rasHT '''zoomAX'',''R'');'];
1390 otherwise, smv = [rasHT '''panAX'',''R'');'];
1391 end;
1392 set(gcf,'WindowButtonMotionFcn',smv,'WindowButtonUpFcn','set(gcf,{''WindowButtonMotionFcn'',''WindowButtonUpFcn''},{'''',''''});');
1393 case 555
1394 x = str2double(get(Hc(4+en0),'str'));
1395 tipo = get(Hc(3),'use'); tipo = tipo((1+fix(en0/2)),:);
1396 xpx = (sum(get(Hc(11),'vis'))==221) | tm(7) | tm(8);
1397 if xpx argo = Hc(11); argo = [get(argo,'x') get(argo,'y')];
1398 if en0 xold=argo(3*en0); else xold=argo(1); end;
1399 else argo = [get(hact,'x') get(hact,'y')];
1400 if ~en0 xold=argo(1); elseif en0==2 xold=argo(2); else xold=0; end;
1401 end;
1402 if length(x)
1403 if xpx ixy = [1 4 5; 2 3 3; 6 7 10; 8 9 9]; argo(ixy(en0+1,:)) = x;
1404 set(Hc(11),'x',argo(1:5),'y',argo(6:10));
1405 else
1406 editd = length(get(hact,'ButtonD'));
1407 if imag(x) x = imag(x); setappdata(hact,'alt',0); end;
1408 if ~en0
1409 RastH = get(hact,'use'); RastH = RastH(1);
1410 xd = get(RastH,'x'); yd = get(RastH,'y');
1411 if editd set(hact,'x',x); plt('click','EDIT','/');
1412 else [v xk] = min(abs(xd-x));
1413 xv = xd(xk);
1414 if xv<xyli(1) | xv>xyli(2) plt('cursor',cador,'set','xlim',xv+[-.5 .5].*diff(xyli(1:2))); end;
1415 plt('cursor',cador,'mainCur',xk);
1416 end;
1417 elseif en0==2 set(hact,'y',x);
1418 if x<xyli(3) | x>xyli(4)
1419 plt('cursor',cador,'set','ylim',x+[-.5 .5].*diff(xyli(3:4)));
1420 end;
1421 if editd plt('click','EDIT','/'); end;
1422 else set(Hc(4+en0),'str',plt('ftoa',tipo,tm(6)));
1423 end;
1424 end;
1425 else set(Hc(4+en0),'str',plt('ftoa',tipo,xold));
1426 end;
1427 case 641
1428 set(Hc(11),'x',[LMda(1:2) 0 0 0],...
1429 'y',[LMda(3) 0 LMda(4) 0 0]);
1430 p0 = getappdata(get(v2,'xlab'),'OldCur');
1431 set(v2,'xli',p0(3:4),'yli',p0(5:6));
1432 plt('cursor',cador,'scale','new',0,0);
1433 case 520
1434 toria = get(nw2,'use');
1435 if isempty(toria) toria = [LMda 1]; end;
1436 lExp = length(toria(:,1));
1437 gasto = find(toria(:,5)==1);
1438 skip = [];
1439 switch sum(en0)
1440 case 330
1441 argo = Hc(11); argo = [get(argo,'x') get(argo,'y')];
1442 apXY = [sort(argo(1:2)) sort(argo([6 8])) 1];
1443 if isequal(LMda,apXY(1:4))
1444 if length(gasto) toria(gasto,5)=1; end;
1445 else
1446 if length(gasto)
1447 toria(gasto,5)=0;
1448 if max(gasto,lExp) < 4
1449 toria = [toria; apXY];
1450 else
1451 if gasto==4 toria(2:4,:)=[toria(3:4,:); apXY];
1452 elseif gasto >= 1 toria(gasto+1,:)=apXY;
1453 end;
1454 end;
1455 else
1456 if lExp < 4 toria = [toria; apXY];
1457 else toria = [toria(lExp-1,:); apXY];
1458 end;
1459 end;
1460 end;
1461 escars=0;
1462 case 319
1463 if sum(get(gcf,'SelectionT'))==321 escars=1;
1464 else
1465 if isempty(gasto) gasto = lExp;
1466 else toria(gasto,5)=0; gasto = gasto-1;
1467 end;
1468 if gasto escars=0; apXY=toria(gasto,:); toria(gasto,5)=1;
1469 else escars=1;
1470 end;
1471 end;
1472 case 441
1473 switch sum(en1)
1474 case 120, escars=2;
1475 case 121, escars=3;
1476 case 429, escars=1;
1477 otherwise, disp([en1 ' is not a valid action in plt(cursor,CurID,scale,auto,In2)']);
1478 end;
1479 otherwise, disp([en0 ' is not a valid action in plt(cursor,CurID,scale,In1)']);
1480 end;
1481 if escars == 0
1482 set(v2,'xli',sort(apXY(1:2)),'yli',sort(apXY(3:4)));
1483 wii = 0;
1484 else
1485 Nrastro=length(Hc)-14; ximo=+inf; xima=-inf;
1486 mc = zeros(Nrastro,2); Rlista = []; wii = 1;
1487 for kk=1:Nrastro
1488 rastro=get(Hc(14+kk),'use');
1489 if sum(get(rastro(1),'vis')) == 221
1490 xdatos = get(rastro(1),'x');
1491 ximo = min(ximo,min(xdatos));
1492 xima = max(xima,max(xdatos));
1493 if wii ydatos = get(rastro(1),'y'); end;
1494 Rlista = [kk Rlista]; wii = 0;
1495 end;
1496 end;
1497
1498 if wii msgbox('Possible autoscale without any visible lines','Warning','warn','modal');
1499 else
1500 for kk=1:Nrastro
1501 k = Hc(14+kk);
1502 mc(kk,:) = [get(k,'x') get(k,'y')];
1503 set(k,'x',xdatos(1),'y',ydatos(1));
1504 end;
1505 skip = findobj(v2,'Tag','SkipCur','vis','on'); set(skip,'vis','of');
1506 switch escars
1507 case 1, set(v2,'YlimM','auto');
1508 apXY = [ximo xima get(v2,'yli') 1];
1509 set(v2,'xli',apXY(1:2));
1510 case 2, apXY = [ximo xima get(v2,'yli') 1];
1511 set(v2,'xli',apXY(1:2));
1512 case 3,
1513 tm=get(nw1,'use');
1514 if ismember(actv,Rlista)
1515 rastro = get(hact,'use'); ydatos = get(rastro(1),'y');
1516 ymax = max(ydatos); ymin = min(ydatos); dy = 0.25*(ymax-ymin);
1517 ymin = ymin - dy; ymax = ymax + dy;
1518 if ymin ~= ymax set(v2,'YlimM','man'); set(v2,'yli',[ymin ymax]); drawnow;
1519 else set(v2,'YlimM','auto'); drawnow;
1520 end;
1521 else set(v2,'YlimM','man'); drawnow; set(v2,'YlimM','auto');
1522 end;
1523 apXY = [LMda 1];
1524 end;
1525 for kk=1:Nrastro set(Hc(14+kk),'x',mc(kk,1),'y',mc(kk,2)); end;
1526 end;
1527 end;
1528 if ~wii
1529 if ax2 set(ax2,'xli',apXY(1:2)); end;
1530 set(nw2,'use',toria);
1531 if aconex & nargin<6
1532 yr = get(ax2,'yli');
1533 set(ax2,'yli',yr(1) + (get(v2,'yli') - LMda(3)) * diff(yr) / (LMda(4)-LMda(3)));
1534 end;
1535 plt('cursor',cador,'restore');
1536 axes(v2); evalQ(get(Hc(5),'use'));
1537 end;
1538 set(v2,'YlimM','man');
1539 set(skip,'vis','on');
1540 plt('grid',v2,'update');
1541 case 548,
1542 RastH = get(hact,'use');
1543 lx = length(get(RastH(1),'x')); xk = tm(1);
1544 ty = get(gcf,'SelectionT'); ty = ty(1);
1545 if ty=='o' & getappdata(gcbo,'ty') ty = 'a'; end;
1546 ty = ty=='a';
1547 if ty xk = max(xk-1,1);
1548 else xk = min(xk+1,lx);
1549 end;
1550 setappdata(gcbo,'ty',ty);
1551 plt('cursor',cador,'mainCur',xk);
1552 if DuaC plt('cursor',cador,'auxCur'); end;
1553 case 763,
1554 RastH = get(hact,'use'); h1 = RastH(1);
1555 x = get(h1,'x'); absc = get(h1,'y'); lx = length(x);
1556 lmx = LMda(1:2); ylim = LMda(3:4); dxlim = diff(lmx);
1557 xk = tm(1); v = get(gcbo,'Val');
1558 x1 = min(x); x2 = max(x); xvalo = x2 - x1;
1559 if xvalo/dxlim < 2
1560 dx = round(v - 500);
1561 if abs(dx)==10 pmove = .01; else pmove = .05; end;
1562 xk = max(min(lx,xk + sign(dx)*round(lx*pmove)),1);
1563 x = x(xk); xd = 1.01 * (x-lmx);
1564 if xd(1)<0 lmx = lmx + xd(1); elseif xd(2)>0 lmx = lmx+xd(2); end;
1565 v = 500;
1566 else
1567 dx = v - get(gcbo,'use');
1568 switch round(abs(dx))
1569 case 10, lmx = lmx + sign(dx)*dxlim/10;
1570 case 100, lmx = lmx + sign(dx)*dxlim;
1571 otherwise, lmx = x1 + xvalo*v/1000 + dxlim*[-.5 .5];
1572 end;
1573 if lmx(1)<x1 lmx = [x1 x1+dxlim] - dxlim/50;
1574 elseif lmx(2)>x2 lmx = [x2-dxlim x2] + dxlim/50;
1575 end;
1576 xlc = mean(lmx);
1577 v = 1000*(xlc-x1)/xvalo;
1578 v = max(min(v,1000),0);
1579 [dmy xk] = min(abs(xlc-x));
1580 end;
1581 set(gcbo,'Val',v,'use',v);
1582 absc = absc(xk); yd = 1.01 * (absc-ylim);
1583 if yd(1)<0 ylim = ylim + yd(1); elseif yd(2)>0 ylim = ylim+yd(2); end;
1584 if sum(LMda - [lmx ylim])
1585 set(v2,'xli',lmx,'yli',ylim);
1586 if ax2 set(ax2,'xli',lmx); end;
1587 if length(findobj(v2,'use','grid')) plt('grid',v2,'update'); end;
1588 evalQ(get(Hc(5),'use'));
1589 end;
1590 plt('cursor',cador,'mainCur',xk);
1591 if DuaC plt('cursor',cador,'auxCur'); end;
1592 case 740
1593 b = gcbo; set(b,'vis','of'); drawnow; set(b,'vis','on');
1594 switch en0
1595 case 2, en0=0; set(Hc(8), 'use',-inf);
1596 case 3, en0=1; set(Hc(9),'use',inf);
1597 end;
1598 RastH = get(hact,'use'); h1 = RastH(1); absc = get(h1,'y'); x = get(h1,'x');
1599 x12 = find(x <= LMda(2) & x >= LMda(1));
1600 if isempty(x12) x = LMda(1); x12 = 1:length(x); disp('You must select a line for the min/max finder'); end;
1601 absc = absc(x12); nabsc = length(absc);
1602 if en0
1603 xk=find(absc < [absc(2:nabsc) inf] & ...
1604 absc < [inf absc(1:nabsc-1)] & ...
1605 absc > get(Hc(9),'use'));
1606 if isempty(xk)
1607 [absc xk] = min(absc);
1608 else [absc kk] = min(absc(xk));
1609 xk = xk(kk);
1610 end;
1611 set(Hc(9),'use',absc);
1612 else
1613 xk=find(absc > [absc(2:nabsc) -inf] & ...
1614 absc > [-inf absc(1:nabsc-1)] & ...
1615 absc < get(Hc(8),'use'));
1616 if isempty(xk)
1617 [absc xk] = max(absc);
1618 else [absc kk] = max(absc(xk));
1619 xk = xk(kk);
1620 end;
1621 set(Hc(8),'use',absc);
1622 end;
1623 xk = xk + x12(1) - 1;
1624 if sum(get(Hc(12),'vis')) == 221
1625 indic = 1;
1626 if RastH(2)==1 clRastro = get(RastH(1),'color');
1627 else clRastro = get(nw2,'backg');
1628 end;
1629 else indic = 0;
1630 clRastro = [];
1631 end;
1632 plt('cursor',cador,'mainCur',xk,x(xk),absc,indic,clRastro);
1633 if DuaC plt('cursor',cador,'auxCur'); end;
1634 case 772
1635 tipo = get(Hc(3),'use');
1636 set(nw2,'str',plt('ftoa',tipo(2,:),tm(3)));
1637 set(nw1,'str',plt('ftoa',tipo(1,:),tm(2)));
1638 set(Hc(11),'vis','of');
1639 if DuaC
1640 RastH = get(Hc(14+DuaC),'use');
1641 if RastH(2)==1
1642 clRastro = get(RastH(1),'color');
1643 set(Hc(7),'str',plt('ftoa',tipo(2,:),tm(6)),'ena','on','backg',clRastro);
1644 else set(Hc(7),'str',plt('ftoa',tipo(2,:),tm(6)),'ena','on')
1645 end;
1646 set(Hc(5),'str','','ena','of','vis','of');
1647 plt('cursor',cador,'auxCur');
1648 else
1649 if sum(get(Hc(12),'vis')) == 315
1650 set(Hc([5 7]),'vis','of','str','');
1651 end;
1652 end;
1653 set(hact,'y',max(xyli(3),min(xyli(4),tm(3))),...
1654 'x',max(xyli(1),min(xyli(2),tm(2))));
1655 set(Hc([2:3]),'ena','inact'); set(Hc(10),'ena','on');
1656 case 560
1657 set(Hc(10),'vis','of','backg',1-get(Hc(10),'backg'));
1658 drawnow; set(Hc(10),'vis','on');
1659 if sum(get(Hc(12),'vis')) == 315
1660 set(Hc(12),'vis','on','par',get(hact,'par'),'use',actv,...
1661 'x',get(hact,'x'),'y',get(hact,'y'));
1662 else set(Hc(12),'vis','of'); set(Hc(8:9),'ena','on');
1663 plt('cursor',cador,'restore');
1664 end;
1665 case 493
1666 fg = get(nw1,'par');
1667 a = flipud(findobj(get(findobj(fg,'use','TraceID'),'child'),'type','text'));
1668 if length(a)<actv s = 'Yval';
1669 else s = deblank(get(a(actv),'str'));
1670 end;
1671 set(findobj(fg,'use','idcur'),{'str','color'},{s,get(hact,'color')});
1672 case 320
1673 switch sum(en0)
1674 case 315
1675 Volv1 = Hc(2:12);
1676 case 885
1677 if nargin2==5 rasNo=en1; else rasNo=actv; end;
1678 k = Hc(14+rasNo);
1679 Volv1 = complex(get(k,'x'),get(k,'y'));
1680 Volv2 = tm(1);
1681 case 1028
1682 RastH = get(hact,'use');
1683 Volv1 = actv;
1684 Volv2 = RastH(1);
1685 case 625
1686 toria = get(nw2,'use');
1687 if isempty(toria)
1688 Volv1 = [[LMda 1]; [zeros(3,4), -ones(3,1)]];
1689 else aa = 4 - length(toria(:,1));
1690 Volv1 = [ toria; [ zeros(aa,4), -ones(aa,1) ] ];
1691 end;
1692 if ax2 Volv1 = [Volv1; [get(ax2,'xli') get(ax2,'yli') 2]];
1693 else Volv1 = [Volv1; [zeros(1,4) -1]];
1694 end;
1695 otherwise, disp('error in plt(cursor,get)');
1696 end;
1697 case 332
1698 switch sum(en0)
1699 case 557
1700 h = [Hc([2:10 14+1:end]) ...
1701 findobj(gcf,'tag','xstr') ...
1702 findobj(gcf,'tag','ystr') ...
1703 findobj(gcf,'use','idcur') ...
1704 findobj(gcf,'tag','xslider')];
1705 h = findobj(h,'vis','on');
1706 set(h,'vis','of');
1707 setappdata(Hc(2),'hid',h);
1708 case 495, set(getappdata(Hc(2),'hid'),'vis','on');
1709 case 885
1710 for kk=2:10 set(Hc(kk),'pos',en1(kk-1,:)); end;
1711 case 334, set(Hc(7),'vis',en1);
1712 if DuaC set(Hc(DuaC),'vis',en1); end;
1713 case 423, set(Hc(2),'str',en1);
1714 case 424, set(Hc(3),'str',en1);
1715 case 570, set(Hc(5),'use',en1);
1716 case 572, if length(en1) & ischar(en1) & en1(1)==';'
1717 setappdata(v2,'moveCBext',1); en1(1) = [];
1718 end;
1719 set(Hc(7),'use',en1);
1720 case 622, set(Hc(7),'Tag',en1);
1721 case {563,443,442},
1722 oldEh = get(nw2,'use');
1723 toria = oldEh;
1724 if length(toria)
1725 gasto = find(toria(:,5)==1);
1726 if length(gasto) toria(gasto,5)=0; end;
1727 end;
1728 switch sum(en0)
1729 case 563, xyl = en1; toria(1,:) = [xyl 1];
1730 case 443
1731 if length(oldEh) toria(1,:) = [LMda(1:2) en1,1]; xyl = [LMda(1:2) en1];
1732 else toria=[]; xyl = [LMda(1:2) en1];
1733 end;
1734 case 442
1735 if length(oldEh) toria(1,:) = [en1 LMda(3:4) 1]; xyl = [en1 LMda(3:4)];
1736 else toria=[]; xyl = [en1 LMda(3:4)];
1737 end
1738 end;
1739 set(v2,'xli',sort(xyl(1:2)),'yli',sort(xyl(3:4)));
1740 set(nw2,'use',toria);
1741 if ax2
1742 if nargin2==6 argo = en2; else argo = get(ax2,'yli'); end;
1743 set(ax2,'xli',xyl(1:2),'yli',argo);
1744 set(nw1,'use',tm);
1745 end;
1746 if length(findobj(v2,'use','grid')) plt('grid',v2,'update'); end;
1747 evalQ(get(Hc(5),'use'));
1748 case 540, set(Hc(8), 'use',-inf); set(Hc(9),'use',inf);
1749 case 625,
1750 if length(en1(1,:)) < 5
1751 plt('cursor',cador,'set','xylim',en1);
1752 elseif isequal(size(en1),[5 5])
1753 toria = [];
1754 for kk=1:5
1755 if kk<=4
1756 if en1(kk,5) >= 0
1757 toria=[toria; en1(kk,:)];
1758 if en1(kk,5) == 1
1759 LMda = en1(kk,1:4);
1760 set(v2,'xli',en1(kk,1:2),'yli',en1(kk,3:4));
1761 if length(findobj(v2,'use','grid'));
1762 plt('grid',v2,'update');
1763 end;
1764 end;
1765 end
1766 else
1767 if en1(kk,5)==2 set(ax2,'xli',en1(kk,1:2),'yli',en1(kk,3:4)); end;
1768 end;
1769 end;
1770 set(nw2,'use',toria);
1771 else disp('error in plt(cursor,CurId,set,expHis,xxx), xxx is wrong shape');
1772 end;
1773 case 1028
1774 if en1
1775 set(hact,'vis','of');
1776 actv = en1;
1777 tm(4) = actv;
1778 iact = 14 + actv;
1779 hact = Hc(iact);
1780 set(hact,'vis','on');
1781 set(nw1,'use',tm);
1782 end;
1783 if nargin<6 en2 = 1; end;
1784 plt('cursor',cador,'mainCur',en2,[],[],[],get(hact,'color'));
1785 end;
1786 case 519
1787 delete(Hc([2:12 14+1:end]));
1788 CurPri(cador) = 0;
1789 if ~sum(CurPri) CurPri = []; end;
1790 setappdata(0,'CurMain',CurPri);
1791 case 925
1792 IsY = strcmp(en0,'y');
1793 Mtipo = get(gcf,'SelectionT');
1794 if strcmp(Mtipo,'normal')
1795 if tm(7+IsY)
1796 plt('cursor',cador,'scale','new'); tm(7)=0; tm(8)=0; set(nw1,'use',tm);
1797 else
1798 tipo = get(Hc(3),'use'); tipo = tipo(IsY+1,:);
1799 of2 = IsY*2;
1800 set(Hc(4 +of2),'str',plt('ftoa',tipo,LMda(of2+1)),'ena','on' );
1801 set(Hc(5+of2),'str',plt('ftoa',tipo,LMda(of2+2)),'ena','on' ,...
1802 'backg',get(nw1,'backg'),'foreg',get(nw1,'foreg'),'vis','on');
1803 tm(7+IsY)=1;
1804 if ~tm(7) | ~tm(8)
1805 set(Hc(11),'x',LMda([1 2 2 1 1]),'y',LMda([3 3 4 4 3]),'vis','on');
1806 end;
1807 set(nw1,'use',tm);
1808 end;
1809 elseif strcmp(Mtipo,'alt')
1810 plt('cursor',cador,'scale','auto',en0);
1811 end;
1812 otherwise disp([accion ' is not a valid action in plt(cursor)']);
1813 end;
1814
1815 case 785
1816 switch varargin{2}
1817 case 0,
1818 p = gcbo; e = getappdata(p,'edt'); f = get(e,'use');
1819 obj = getappdata(p,'obj'); obj = obj(1);
1820 c = get(p,'str'); v = get(p,'Val'); prop = deblank(c(v,:));
1821 if strcmp(prop,'Delete') & ishandle(obj) delete(obj); end;
1822 if ishandle(obj)
1823 s = get(obj,prop);
1824 if isnumeric(s) set(e,'str',plt('vtoa','%6w',s,' '));
1825 if f & length(s)==3 plt('ColorEdit',2,f,2); end;
1826 else set(e,'str',s);
1827 end;
1828 else set(e,'str','Deleted');
1829 end;
1830 case 1,
1831 e = gcbo; p = getappdata(e,'pop'); obj = getappdata(p,'obj');
1832 c = get(p,'str'); v = get(p,'Val'); prop = deblank(c(v,:));
1833 s = get(e,'str'); f = get(e,'use');
1834 if strcmp(prop,'Delete')
1835 if strcmpi(s,'all')
1836 if length(c(:,1))==9 c='line'; else c='text'; end;
1837 delete(findobj(get(get(e,'par'),'use'),'type',c,'tag','mark'));
1838 end;
1839 else if isnumeric(get(obj(1),prop))
1840 s = str2num(s);
1841 tid = getappdata(p,'tid');
1842 if length(s)==3 set(tid,prop,s); end;
1843 end;
1844 set(obj,prop,s);
1845 if f plt('ColorEdit',2,f,2); end;
1846 end;
1847 case 2,
1848 p = gcbo; e = getappdata(p,'edt'); v = get(p,'Val'); f = get(e,'use');
1849 h = get(p,'use'); h = h{v}(1);
1850 if v==3 c = get(h,'xcol');
1851 else c = get(h,'color');
1852 end;
1853 set(e,'str',plt('vtoa','%6w',c,' '));
1854 if f plt('ColorEdit',2,f,2); end;
1855 case 3,
1856 e = gcbo; p = getappdata(e,'pop'); v = get(p,'Val');
1857 c = str2num(get(e,'str'));
1858 h = get(p,'use'); h = h{v};
1859 if v==3 set(h,'xcol',c,'ycol',c);
1860 else set(h,'color',c);
1861 end;
1862 end;
1863
1864 case 642
1865 t = gco;
1866 Cpunta = get(get(t,'par'),'curre');
1867 if nargin==1
1868 switch sum(get(gcf,'SelectionT'));
1869 case 649
1870 setappdata(t,'Dxy',diff([Cpunta(1,:); get(t,'pos')]));
1871 set(gcf,'WindowButtonMotionFcn','plt(''marker'',0);','WindowButtonUpFcn','set(gcf,{''WindowButtonMotionFcn'',''WindowButtonUpFcn''},{'''',''''});');
1872 case 321
1873 callc = 'plt(''ColorEdit'',0);';
1874 callp = 'plt(''MarkEdit'',0);';
1875 calle = 'plt(''MarkEdit'',1);';
1876 set(0,'units','pix'); sz = get(0,'screens');
1877 szw = sz(3) - 302 - 4;
1878 ppos = get(gcf,'pos');
1879 if ppos(4)<1 sp = sz(3:4); ppos = ppos .* [sp sp]; end;
1880 xp = min(ppos(1)+ppos(3)+6,szw);
1881 yp = ppos(2)+ppos(4)-85-30*length(findobj('type','fig','use',gcf));
1882 figure('menu','none','number','off','Back','off','resize','off','pos',[xp yp 302 85],'color',[0,.4,.4],'name','Edit Marker','use',gcf,...
1883 'closereq','plt(''click'',''mark'',4);');
1884 ed1 = uicontrol('sty','edit','pos',[8 5 130 22],'call',calle,'ButtonD',callc,'use',0);
1885 pu1 = 'Delete|Color|LineStyle|LineWidth|Marker|MarkerSize|Xdata|Ydata|Zdata';
1886 pu1 = uicontrol('sty','pop','str',pu1,'pos',[8 35 130 20],'call',callp,'Val',5);
1887 uicontrol('sty','text','str', 'Marker properties:','pos',[8 64 130 17]);
1888 ed2 = uicontrol('sty','edit','pos',[145 5 150 22],'call',calle,'ButtonD',callc,'use',0);
1889 pu2 = uicontrol('sty','pop','str','Delete|Color|FontAngle|FontName|FontSize|FontWeight|HorizontalAlign|Position|Rotation|String|VerticalAlign',...
1890 'pos',[145 35 150 20],'call',callp,'Val',10);
1891 uicontrol('sty','text','str', 'String properties:','pos',[145 64 150 17]);
1892 set([ed1 ed2 pu1 pu2],'backg',[.8,.8,.9],'foreg','black');
1893 l = get(t,'use');
1894 setappdata(ed1,'pop',pu1); setappdata(pu1,'edt',ed1); setappdata(pu1,'obj',l);
1895 setappdata(ed2,'pop',pu2); setappdata(pu2,'edt',ed2); setappdata(pu2,'obj',t);
1896 if ishandle(l) l=get(l,'Marker'); else l='Deleted'; end;
1897 if ishandle(t) t=get(t,'str'); else t='Deleted'; end;
1898 set(ed1,'str',l); set(ed2,'str',t);
1899 end;
1900 else dxy = Cpunta(1,:) + getappdata(t,'Dxy'); set(t,'pos',dxy(1:2));
1901 end;
1902
1903 case 901
1904 switch varargin{2}
1905 case 0,
1906 e = gcbo;
1907 c = str2num(get(e,'str'));
1908 if length(c) ~= 3 return; end;
1909 f = get(e,'use');
1910 if ~f
1911 par = get(e,'par');
1912 f = figure('menu','none','number','off','Back','off','pos',get(par,'pos')+[0 -150 0 120],'color',[0,.4,.4],...
1913 'name','Color select','use',get(par,'use'),...
1914 'closereq','plt(''ColorEdit'',4);');
1915 s1 = [0 100];
1916 s4 = 'plt(''ColorEdit'',1,%d,%d);'; d = c*100;
1917 s = [plt('slider',[.025 .870 110],[d(1) s1 s1],'Red (%)' ,sprintf(s4,1,f),2);
1918 plt('slider',[.025 .545 110],[d(2) s1 s1],'Green (%)',sprintf(s4,2,f),2);
1919 plt('slider',[.025 .220 110],[d(3) s1 s1],'Blue (%)' ,sprintf(s4,3,f),2);
1920 ]';
1921 v2 = axes('xli',[.8 12.15],'yli',[.8 15.4],'color',[0 0 0],'xcol',[0,.4,.4],'ycol',[0,.4,.4],'XtickL',' ','YtickL',' ','TickLen',[0 0]',...
1922 'units','nor','pos',[.408 .02 .57 .96]);
1923 ph = zeros(11,11);
1924 cb = sprintf('plt(''ColorEdit'',2,%d);',f);
1925 for fila = 1:11
1926 for col = 1:11
1927 ph(fila,col) = patch(col+[0 1 1 0],fila+[0 0 1 1],[0 0 0],'use',[fila col],'ButtonD',cb);
1928 end;
1929 end;
1930 pat = patch([1 12 12 1],12+[.5 .5 3 3],c,'use',ph,'ButtonD',sprintf('plt(''ColorEdit'',2,%d,1);',f));
1931 set(v2,'use',[s e pat c]); set(e,'use',f);
1932 end;
1933 plt('ColorEdit',2,f,2);
1934 case 1,
1935 s = varargin{3};
1936 f = varargin{4};
1937 v2 = findobj(f,'type','axes');
1938 u = get(v2,'use');
1939 c = [0 0 0];
1940 for k=1:3
1941 h = u(k);
1942 c(k) = plt('slider',h,'get')/100;
1943 if k==s bk = [1 1 0]; else bk = [0 1 1]; end;
1944 obj = plt('slider',h,'get','obj');
1945 set(obj(5),'backg',bk);
1946 end;
1947 ph = get(u(5),'use');
1948 phc = [0 0 0];
1949 phc(s) = c(s);
1950 v = mod(s,3)+1; w = mod(v,3)+1;
1951 for fila = 1:11
1952 phc(v) = (fila-1)/10;
1953 for col = 1:11
1954 phc(w) = (col-1)/10;
1955 set(ph(fila,col),'FaceColor',phc);
1956 end;
1957 end;
1958 set(u(5),'FaceColor',c);
1959 es = get(u(4),'str');
1960 if es(1)~='[' return; end;
1961 set(u(4),'str',plt('vtoa','%6w',c,' '));
1962 p = getappdata(u(4),'pop');
1963 s = get(p,'str'); v = get(p,'Val'); obj = getappdata(p,'obj');
1964 if length(obj)
1965 prop = deblank(s(v,:));
1966 set(obj,prop,c);
1967 tid = getappdata(p,'tid');
1968 if tid set(tid,prop,c); end;
1969 else h = get(p,'use'); h = h{v};
1970 if v==3 set(h,'xcol',c,'ycol',c);
1971 else set(h,'color',c);
1972 end;
1973 end;
1974 case 2,
1975 f = varargin{3};
1976 v2 = findobj(f,'type','axes');
1977 u = get(v2,'use');
1978 if nargin<4 in4 = 0; else in4 = varargin{4}; end;
1979 switch in4
1980 case 0, c = get(gcbo,'FaceColor');
1981 case 1, c = u(6:8);
1982 case 2, c = str2num(get(u(4),'str'));
1983 if length(c)~=3 return; end;
1984 end;
1985 for k=1:3
1986 obj = plt('slider',u(k),'get','obj'); bk =get(obj(5),'backg');
1987 if bk(1) break; end;
1988 end;
1989 v = mod(k,3)+1; w = mod(v,3)+1;
1990 plt('slider',u(v),'set',c(v)*100);
1991 plt('slider',u(w),'set',c(w)*100);
1992 plt('slider',u(k),'set',c(k)*100);
1993 case 4,
1994 u = get(findobj(gcf,'type','axes'),'use');
1995 if ishandle(u(4)) set(u(4),'use',0); end;
1996 closereq;
1997 end;
1998
1999 case 434
2000 if nargin<2 [fi pth] = uigetfile('plt.plt','Select plt figure to open');
2001 if isnumeric(fi) return; end;
2002 fi = [pth fi];
2003 else fi = varargin{2};
2004 end;
2005 ydat = [];
2006 feval('load',fi,'-mat');
2007 if isempty(ydat)
2008 p = find(fi=='.');
2009 if length(p) f = [fi(1:p(end)) 'mat']; end;
2010 dos(['copy ' fi ' ' f ' > NUL:']);
2011 load(f); delete(f);
2012 end;
2013 xdat = [xdat'; ydat'];
2014 plt(xdat{:},params{:});
2015
2016 case 431
2017 if nargin<2 [fi pth] = uiputfile('plt.plt','Save plt figure as');
2018 if isnumeric(fi) return; end;
2019 fi = [pth fi];
2020 else fi = varargin{2};
2021 end;
2022 AX = findobj(gcf,'Tag','click');
2023 cador = get(AX,'use');
2024 AX2 = findobj(gcf,'YAxisLoc','right','use',cador);
2025 RastH = getappdata(gcf,'Lhandles');
2026 xdat = get(RastH,'x'); ydat = get(RastH,'y');
2027 xlm = get(AX,'xli'); ylm = get(AX,'yli');
2028 xymult = getappdata(gcf,'xymult');
2029 if xymult(1) ~= 1
2030 mult = 1/xymult(1);
2031 for k = 1:length(xdat) xdat{k} = mult * xdat{k}; end;
2032 xlm = xlm * mult;
2033 end;
2034 ym = 1;
2035 for k = 1:length(ydat)
2036 mult = xymult(k+1);
2037 if mult ~= 1
2038 mult = 1/mult;
2039 if ym ylm=ylm*mult; ym=0; end;
2040 ydat{k} = mult * ydat{k};
2041 end;
2042 end;
2043 v = get(RastH,'vis'); v = [v{:}];
2044 params = [getappdata(gcf,'params') { ...
2045 'position' get(gcf,'pos') ...
2046 'DIStrace' v(find(v=='o')+1)=='f' ...
2047 'Xlim' xlm ...
2048 'Ylim' ylm }];
2049 if AX2 params = [params {'YlimR' get(AX2,'yli')}]; end;
2050 ver = '11May10';
2051 save(fi,'xdat','ydat','params','ver');
2052
2053 case 518
2054 y2 = varargin{2};
2055 AX = findobj(gcf,'Tag','click');
2056 cador = get(AX,'use');
2057 AX2 = findobj(gcf,'YAxisLoc','right','use',cador);
2058 AXrl = [AX AX2];
2059 if isempty(AX2) AX2=0; end;
2060 CurPri = getappdata(0,'CurMain');
2061 Hc = get(CurPri(cador),'use');
2062 if ischar(y2)
2063 switch sum(y2)
2064 case 430
2065 s = get(gcbo,'str');
2066 if s(1)==92 & s(2)=='d' s = s(6:end-5);
2067 else s = ['\div ' s ' \div'];
2068 end;
2069 set(gcbo,'str',s);
2070 case 733
2071 imX = get(AX,'xli'); imY = get(AX,'yli');
2072 d = [-.2 .2]; dr = 'o';
2073 clic = get(gcf,'SelectionT'); clic = clic(1);
2074 if clic=='a' | (clic=='o' & getappdata(AX,'dir')=='i')
2075 d = d/-1.4; dr = 'i';
2076 end;
2077 set(AXrl,'xli',imX + diff(imX)*d);
2078 set(AX ,'yli',imY + diff(imY)*d);
2079 if AX2 axl = get(get(AX2,'ylabel'),'str');
2080 if axl(1)~=92 | axl(2) ~= 'd';
2081 imY = get(AX2,'yli'); set(AX2,'yli',imY + diff(imY)*d);
2082 end;
2083 end;
2084 plt('grid',AX,'update');
2085 setappdata(AX,'dir',dr);
2086 axes(AX); evalQ(get(Hc(5),'use'));
2087 case 427
2088 if nargin>2 in3 = varargin{3}; else in3 = -1; end;
2089 switch in3
2090 case 3,
2091 cFIGbk = get(gcf,'color');
2092 cPLTbk = get(AX,'color');
2093 if isstr(cPLTbk) cPLTbk = get(AX2,'color'); end;
2094 cXYax = get(AX,'xcol');
2095 cXYlbl = get(get(AX,'xlab'),'color');
2096 cGRID = get(findobj(gcf,'type','line','use','grid'),'color');
2097 cDELTA = get(findobj(gcf,'type','line','tag','DeltaC'),'color');
2098 cTRACE = get(getappdata(gcf,'Lhandles'),'color');
2099 cTRACE = reshape([cTRACE{:}],3,length(cTRACE))';
2100 cFile = get(findobj(gcf,'style','push','str','D'),'tag');
2101 if isempty(cFile) [cFile pth] = uiputfile('*.mat','Select file for saving colors');
2102 cFile = [pth cFile];
2103 end;
2104 if sum(cFile)
2105 save(cFile,'cFIGbk','cPLTbk','cXYax','cXYlbl','cGRID','cDELTA','cTRACE');
2106 else disp('No file was selected'); end;
2107 return;
2108 case 4,
2109 h = findobj(gcf,'style','edit');
2110 for k=1:length(h)
2111 f = get(h(k),'use');
2112 if f & ishandle(f) close(f); end;
2113 end;
2114 closereq;
2115 return;
2116 end;
2117 set(0,'units','pix'); sz = get(0,'screens');
2118 szw = sz(3) - 302 - 4;
2119 ppos = get(gcf,'pos');
2120 if ppos(4)<1 sp = sz(3:4); ppos = ppos .* [sp sp]; end;
2121 xp = min(ppos(1)+ppos(3)+6,szw);
2122 yp = ppos(2)+ppos(4)-85-30*length(findobj('type','fig','use',gcf));
2123 callc = 'plt(''ColorEdit'',0);';
2124 if in3==2
2125 g = gcf;
2126 figure('menu','none','number','off','Back','off','resize','off','pos',[xp yp+25 302 60],'color',[0,.4,.4],'name','Edit figure colors','use',g,...
2127 'closereq','plt(''click'',''mark'',4);');
2128 ps = 'Figure background|Plot background|Axis color|Axis labels|Grid color|Delta cursor';
2129 pu = uicontrol('sty','pop','str',ps,'pos',[80 35 140 20],'call','plt(''MarkEdit'',2);');
2130 ed = uicontrol('sty','edit','pos', [80 5 140 22],'call','plt(''MarkEdit'',3);','ButtonD',callc,'use',0);
2131 set([ed pu],'backg',[.8,.8,.9],'foreg','black');
2132 setappdata(ed,'pop',pu); setappdata(pu,'edt',ed); setappdata(pu,'obj',[]);
2133 set(ed,'str',plt('vtoa','%6w',get(g,'color'),' '));
2134 v2 = findobj(g,'type','axes'); a = v2(1); ap = a;
2135 if isstr(get(ap,'color')) ap = v2(end); end;
2136 set(pu,'use',{[g v2(2)];
2137 ap;
2138 a;
2139 [get(a,'xlab'); get(a,'ylab'); get(v2(2),'child')];
2140 findobj(g,'type','line','use','grid');
2141 findobj(g,'type','line','tag','DeltaC');
2142 });
2143 return;
2144 end;
2145 nw1 = Hc(4);
2146 tm = get(nw1,'use');
2147 actv = tm(4);
2148 iact = 14 + actv;
2149 hact = Hc(iact);
2150 clic = get(gcf,'SelectionT'); clic = clic(1);
2151 if clic=='a' | nargin>2
2152 h = findobj(gcf,'use','TraceID'); tx = []; hb = []; tid = [];
2153 if length(h) h = flipud(get(h,'child'));
2154 tx = findobj(h,'type','text'); tid = tx(actv);
2155 h = findobj(h,'type','line');
2156 bt = get(h,'button');
2157 if iscell(bt)
2158 hb = h(find(cellfun('length',bt)));
2159 if length(hb)>=actv tid = [tid hb(actv)]; end;
2160 end;
2161 end;
2162 c = hact;
2163 h = get(c,'use'); h = h(1);
2164 if in3>=0 alll = in3;
2165 else alll = get(Hc(11),'vis');
2166 alll = alll(2)=='n';
2167 end;
2168 if alll c = []; h = [];
2169 for kk=14+1:length(Hc)
2170 RastH = get(Hc(kk),'use');
2171 c = [c Hc(kk)]; h = [h RastH(1)];
2172 end;
2173 tid = [tx; hb];
2174 fname = 'Edit all lines';
2175 else fname = sprintf('Edit Line %d',actv);
2176 end;
2177 callp = 'plt(''MarkEdit'',0);';
2178 calle = 'plt(''MarkEdit'',1);';
2179 figure('menu','none','number','off','Back','off','resize','off','pos',[xp yp 302 85],'color',[0,.4,.4],'name',fname,'use',gcf,...
2180 'closereq','plt(''click'',''mark'',4);');
2181 props = 'Color|LineStyle|LineWidth|Marker|MarkerSize|Xdata|Ydata|Zdata';
2182 ed1 = uicontrol('sty','edit','pos',[8 5 130 22],'call',calle,'ButtonD',callc,'use',0);
2183 pu1 = uicontrol('sty','pop','str',props,'pos',[8 35 130 20],'call',callp);
2184 uicontrol('sty','text','str', 'Line properties:','pos',[8 64 130 17]);
2185 ed2 = uicontrol('sty','edit','pos',[145 5 150 22],'call',calle,'ButtonD',callc,'use',0);
2186 pu2 = uicontrol('sty','pop','str',props,'pos',[145 35 150 20],'call',callp,'Val',5);
2187 uicontrol('sty','text','str', 'Cursor properties:','pos',[145 64 150 17]);
2188 set([ed1 ed2 pu1 pu2],'backg',[.8,.8,.9],'foreg','black');
2189 setappdata(ed1,'pop',pu1); setappdata(pu1,'edt',ed1); setappdata(pu1,'obj',h); setappdata(pu1,'tid',tid);
2190 setappdata(ed2,'pop',pu2); setappdata(pu2,'edt',ed2); setappdata(pu2,'obj',c); setappdata(pu2,'tid',[]);
2191 set(ed1,'str',plt('vtoa','%6w',get(h(1),'color'),' '));
2192 set(ed2,'str',get(c(1),'MarkerSize'));
2193 axes(AX);
2194 else
2195 nw2 = Hc(6);
2196 axes(AX);
2197 x = get(hact,'x'); absc = get(hact,'y');
2198 p = get(hact,'par');
2199 rlim = [];
2200 if p ~= AX
2201 rlim = get(p,'yli');
2202 ylim = get(AX,'yli');
2203 absc = ylim(1) + diff(ylim) * (absc - rlim(1)) / diff(rlim);
2204 end;
2205 l = line(x,absc,'marker','s');
2206 t = text(x,absc,[' (' get(nw1,'str') ', ' get(nw2,'str') ')'],...
2207 'fontsi',get(p,'fontsi'),'use',l,'ButtonD','plt(''marker'');');
2208 set([t l],'color',get(hact,'color'),'tag','mark');
2209 if length(rlim)
2210 set(l,'tag','markR','use',[t AX p ylim rlim]);
2211 end;
2212 end;
2213
2214 case 674
2215 hl = findobj(gcf,'ButtonD','plt(''click'',''TGLlogy'');');
2216 if strcmp(get(AX,'Yscale'),'log')
2217 sc='linear'; st='LinY';
2218 else sc='log'; st='LogY';
2219 absc = get(AX,'yli'); if absc(1)<=0 set(AX,'yli',absc(2)*[.001 1]); end;
2220 if AX2
2221 absc = get(AX2,'yli'); if absc(1)<=0 set(AX2,'yli',absc(2)*[.001 1]); end;
2222 end;
2223 end;
2224 set(AXrl,'Yscale',sc); set(hl,'str',st);
2225 case 673
2226 hl = findobj(gcf,'ButtonD','plt(''click'',''TGLlogx'');');
2227 if strcmp(get(AX,'Xscale'),'log')
2228 sc='linear'; st='LinX';
2229 else sc='log'; st='LogX';
2230 x = get(AX,'xli'); if x(1)<=0 set(AXrl,'xli',x(2)*[.001 1]); end;
2231 end;
2232 set(AXrl,'Xscale',sc); set(hl,'str',st);
2233 case 653, set(AX,'TickLen',(1-plt('grid',AX,'toggle'))*[.01 .025]);
2234 a = getappdata(gcf,'axis');
2235 if AX2 a(end) = []; end;
2236 for k=2:length(a)
2237 set(a(k),'TickLen',(1-plt('grid',a(k),'toggle'))*[.01 .025]);
2238 end;
2239
2240 case 668
2241 if strcmp(get(gcf,'SelectionT'),'normal')
2242 f = get(gcf,'menu');
2243 if f(1)=='f' delete(findobj(gcf,'type','uimenu')); set(gcf,'menu','none');
2244 else set(gcf,'menu','fig');
2245 v = get(0,'ShowHidden');
2246 set(0,'ShowHidden','on');
2247 a = findobj(gcf,'label','&File');
2248 uimenu(a,'Label','p< save','separator','on','call','plt(''save'');');
2249 uimenu(a,'Label','pl&t open','call','plt(''open'');');
2250 uimenu(a,'Label','plt &hardCopy','call','plt(''hcpy'',''init'',gcf);');
2251 c = get(a,'child');
2252 set(a,'child',c([4:end-3 1:3 end-2:end]));
2253 set(0,'ShowHidden',v);
2254 liy = uimenu('label','&Color');
2255 uimenu(liy,'label','&Edit line','accel','e','call','plt(''click'',''mark'',0);');
2256 uimenu(liy,'label','&Edit all lines', 'call','plt(''click'',''mark'',1);');
2257 uimenu(liy,'label','&Edit figure colors', 'call','plt(''click'',''mark'',2);');
2258 uimenu(liy,'label','&Save figure colors', 'call','plt(''click'',''mark'',3);','separator','on');
2259 end;
2260 else
2261 k = get(gcbo,'use'); if isempty(k) k=1; end;
2262 mrk = 'none'; sty = '-';
2263 switch k
2264 case 1, mrk = 'o'; sty = 'none';
2265 case 2, mrk = 'o';
2266 case 3, k = 0;
2267 end;
2268 set(gcbo,'use',k+1);
2269 set(getappdata(gcf,'Lhandles'),'marker',mrk,'linestyle',sty);
2270 end;
2271 case 242
2272 Hc = get(CurPri(cador),'use');
2273 tm = get(Hc(4),'use');
2274 lH = get(Hc(14+tm(4)),'use');
2275 nw1 = Hc(4); nw2 = Hc(6); hix2 = Hc(5); hiy2 = Hc(7);
2276 x = get(lH(1),'x'); absc = get(lH(1),'y');
2277 lmx = get(Hc(13),'xli');
2278 x12 = find(x >= lmx(1) & x <= lmx(2));
2279 absc = absc(x12); absc = absc(~isnan(absc)); nabsc = length(absc);
2280 p = findobj(gcf,'use','idcur'); ps = get(p,'str');
2281 switch sum(ps)
2282 case 286, s = 'RMS'; r = plt('ftoa','%7w',sqrt(sum(absc.^2)/nabsc));
2283 case 242, s = 'y/x';
2284 xr = s2d(get(nw1,'str'));
2285 r = getappdata(p,'idcur');
2286 r = plt('ftoa','%7w',s2d(r{2})/xr);
2287 if sum(get(hiy2,'vis'))==221 & sum(get(hix2,'vis'))==221
2288 xr = str2num(get(hix2,'str'));
2289 set(hiy2,'str',s2d(get(hiy2,'str'))/xr);
2290 end;
2291 case 288, s = '\surdx^2+y^2';
2292 xr = s2d(get(nw1,'str'));
2293 q = getappdata(p,'idcur');
2294 r = plt('ftoa','%7w',abs(xr + s2d(q{2})*1j));
2295 if sum(get(hiy2,'vis'))==221 & sum(get(hix2,'vis'))==221
2296 xr = str2num(get(hix2,'str'));
2297 set(hiy2,'str',abs(xr + s2d(q{3})*1j));
2298 end;
2299 case 1110, r = getappdata(p,'idcur'); s = r{1}; set(hiy2,'str',r{3}); r = r{2};
2300 otherwise, setappdata(p,'idcur',{ps get(nw2,'str') get(hiy2,'str')});
2301 s = 'Avg';
2302 r = plt('ftoa','%7w',sum(absc)/nabsc);
2303 end;
2304 set(p,'str',s); set(nw2,'str',r);
2305 case 294
2306 v3 = varargin{3}; en2 = v3 - '0';
2307 if en2>5
2308 Cpunta = get(get(gco,'par'),'curre'); en2 = en2-5;
2309 if bitget(en2,1) set(gco,'x',Cpunta(1,1)); end;
2310 if en2>1 set(gco,'y',Cpunta(1,2)); end;
2311 return;
2312 end;
2313 if en2>2
2314 set(gcf,'WindowButtonMotionFcn',['plt click EDIT ' char(v3+3) ';'],...
2315 'WindowButtonUpFcn',['set(gcf,{''WindowButtonMotionFcn'',''WindowButtonUpFcn''},{'''',''''});' ' plt click EDIT /;']);
2316 return;
2317 end;
2318 Hc = get(CurPri(cador),'use');
2319 tm = get(Hc(4),'use');
2320 hact = Hc(14 + tm(4));
2321 mksz = get(hact,'markersize');
2322 sz = (196-get(0,'screenpix'))/10;
2323 if en2==-1
2324 RastH = get(hact,'use'); RastH = RastH(1);
2325 x = get(RastH,'x'); absc = get(RastH,'y'); kk = tm(1);
2326 x1 = get(hact,'x'); y1 = get(hact,'y');
2327 if strcmp(get(gcf,'SelectionT'),'alt') | length(getappdata(hact,'alt'))
2328 setappdata(hact,'alt','');
2329 iUlti = getappdata(hact,'ilast'); x0 = x(iUlti); y0 = absc(iUlti);
2330 inc = 1 - 2*(iUlti>kk); passo = max(1,abs(iUlti-kk));
2331 dx = (x1-x0)/passo; dy = (y1-y0)/passo;
2332 for k = iUlti:inc:kk x(k)=x0; absc(k)=y0; x0=x0+dx; y0=y0+dy; end;
2333 else
2334 if mksz==sz x(kk)=x1; absc(kk)=y1;
2335 else
2336 ylim = get(Hc(13),'yli');
2337 if y1<ylim(1) x(kk) = []; absc(kk) = [];
2338 else x = [x(1:kk) x1 x(kk+1:end)];
2339 absc = [absc(1:kk) y1 absc(kk+1:end)];
2340 end;
2341 end;
2342 end;
2343 set(RastH,'x',x,'y',absc);
2344 setappdata(hact,'i',kk);
2345 setappdata(gcf,'NewData',1);
2346 return;
2347 end;
2348 liy = get(hact,'marker');
2349 p = get(hact,'par');
2350 v2 = findobj(gcf,'type','axes','tag','click');
2351 if en2==2 sz=sz+4; end;
2352 switch liy(1)
2353 case '^', k = 1;
2354 case '>', k = 2;
2355 case 'd', k = 3;
2356 otherwise, k = 0;
2357 end;
2358 switch k + 4*isempty(getappdata(gcf,'DataEdit')) + 8*~en2
2359 case {1,5}, c = '>'; b = 'plt click EDIT 3;';
2360 case {3,4,7}, c = '^'; b = 'plt click EDIT 4;';
2361 case {0,2,6}, c = 'd'; b = 'plt click EDIT 5;';
2362 otherwise, b = '';
2363 end;
2364 if p ~= v2 set(v2,'vis','of'); end;
2365 if length(b) ~= length(get(hact,'ButtonD'))
2366 ch = get(p,'child');
2367 if length(b) a = find(ch==hact);
2368 setappdata(hact,'swapp',{a liy mksz});
2369 else a = getappdata(hact,'swapp');
2370 c = a{2}; sz = a{3}; a = a{1};
2371 if p ~= v2 set(v2,'vis','on'); end;
2372 end;
2373 sv = ch(a); ch(a) = ch(1); ch(1) = sv; set(p,'child',ch);
2374 end;
2375 set(hact,'marker',c,'markersize',sz,'ButtonD',b);
2376 axes(AX);
2377 end;
2378 plt('grid',AX,'update');
2379 else y8 = y2/8192; j = y8(2);
2380 Mtipo = get(gcf,'SelectionT');
2381 p = {'color'; 'marker'; 'linestyle'; 'linewidth'}; q = {[0 .3 .3] 'none' '-' 9};
2382 if strcmp(Mtipo,'normal')
2383 k = y8(1); s = get(k,'vis');
2384 mk = getappdata(j,'mk');
2385 if s(2)=='f' set(k,'vis','on'); set(j,'fonta','nor','fontw','bol'); set(mk,p,get(k,p));
2386 else set(k,'vis','of'); set(j,'fonta','ita','fontw','nor'); set(mk,p,q);
2387 end;
2388 else
2389 Mtipo = strcmp(Mtipo,'open');
2390 for k = get(get(j,'par'),'child')'
2391 t = get(k,'ButtonD'); bk = findstr(t,'['); w = get(k,'type');
2392 if w(1)=='t' & length(bk)
2393 t = s2i(t(bk+1:findstr(t,' ')))/8192;
2394 mk = getappdata(k,'mk');
2395 if Mtipo | k==j set(t,'vis','on'); set(k,'fonta','nor','fontw','bol'); set(mk,p,get(t,p));
2396 else set(t,'vis','of'); set(k,'fonta','ita','fontw','nor'); set(mk,p,q);
2397 end;
2398 end;
2399 end;
2400 end;
2401 DuaC = getappdata(AX,'DualCur');
2402 Lh = getappdata(AX,'Lhandles');
2403 if DuaC v = get(Lh(DuaC),'vis'); else v = 'off'; end;
2404 plt('cursor',cador,'set','aux',v);
2405 ls = findobj(Lh,'par',AX);
2406 v = 'off';
2407 for k=1:length(ls)
2408 if strcmp(get(ls(k),'vis'),'on') v = 'on'; break; end;
2409 end;
2410 set(get(AX,'Ylabel'),'vis',v);
2411 if AX2
2412 ls = findobj(Lh,'par',AX2);
2413 v = 'off'; izquC = get(AX2,'color');
2414 for k=1:length(ls)
2415 if strcmp(get(ls(k),'vis'),'on') v = 'on'; izquC = 'none';
2416 set(AX2,'xli',get(AX,'xli'));
2417 break;
2418 end;
2419 end;
2420 set(AX2,'vis',v); set(AX,'color',izquC);
2421 end;
2422 TIDback = getappdata(get(j,'par'),'TIDcback');
2423 if isempty(TIDback) return; end;
2424 evalRep(TIDback,{'@TID',int2str(y2(2)),'@LINE',int2str(y2(1))});
2425 axes(AX);
2426 end;
2427
2428 case 708,
2429 v2 = getappdata(gcf,'axis'); v2 = v2(1);
2430 cid = getappdata(gcf,'cid'); fct = length(cid);
2431 ylbl = get(v2,'Ylabel');
2432 obj = getappdata(ylbl,'obj');
2433 if length(obj)
2434 setappdata(ylbl,'obj',[]);
2435 for k=1:fct plt('cursor',cid(k),'set','visON'); end;
2436 if obj(1) set(obj,'vis','on'); end;
2437 else
2438 for k=1:fct plt('cursor',cid(k),'set','visOFF'); end;
2439 a = findobj(gcf,'str','Zout');
2440 if length(a) a = get(a(1),'par');
2441 obj = [a; get(a,'child')];
2442 set(obj,'vis','of');
2443 else obj = 0;
2444 end;
2445 setappdata(ylbl,'obj',obj);
2446 end;
2447
2448 case 944,
2449 h = findobj(gcf,'use','TraceID');
2450 if isempty(h) return; end;
2451 h = flipud(findobj(get(h,'child'),'type','text'));
2452 lix = length(h);
2453 e = varargin{2};
2454 e(find(e>lix)) = [];
2455 v = zeros(lix,1);
2456 v(e) = 1;
2457 v = find(xor(v,3-cellfun('length',get(getappdata(gcf,'Lhandles'),'vis'))));
2458 if isempty(v) return; end;
2459 b = get(h,'button');
2460 eval([b{v}]);
2461
2462 case {959, 534}, for f = findobj('type','fig')'
2463 b = get(f,'ButtonD');
2464 if length(b)>3 & strcmp(b(1:4),'plt(')
2465 set(f,'closereq','closereq');
2466 close(f);
2467 end;
2468 end;
2469 case 632, set(flipud(findobj(get(findobj(gcf,'use','TraceID'),'child'),'type','text')), ...
2470 {'str'},varargin{2}(:));
2471 case 774, Volv1 = '11May10'; Volv2 = 0;
2472 case 425, eval('plt(''helpv'',0);');
2473
2474 otherwise,
2475 cTRACE = [0 1 0; 1 0 1; 0 1 1; 1 0 0; .2 .6 1;
2476 1 1 1; 1 .6 .2; 0 0 1; 1 .2 .6; .2 1 .6;
2477 .6 1 .2; .6 .2 1; 1 1 0; 0 .6 0; .6 0 .6;
2478 0 .6 .6; .6 .6 0; .7 .7 .7; .6 0 0; .2 .2 .7;
2479 .5 .5 .5; .7 .2 .2; .2 .7 .2; 0 0 .6; .3 .3 .3;
2480 0 .9 .4; 0 .4 .9; .9 .4 0; .4 .9 0; .9 0 .4;
2481 .4 0 .9; .8 .5 .5; .5 .8 .5; .5 .5 .8;];
2482 posFIG = [9 45 700 525];
2483 posFIGd = 1;
2484 o4 = ones(1,4);
2485 axisPOS = o4;
2486 idPOS = o4;
2487 POScid = [3,-.075];
2488 cFIGbk = [.25 .15 .15];
2489 cPLTbk = [0 0 0 ];
2490 cXYax = [1 1 1 ];
2491 cXYlbl = [.7 .8 .95];
2492 CURcDEF = [1 1 .50];
2493 cCRSR = CURcDEF;
2494 cDELTA = [1 0 0 ];
2495 cGRID = [.3 .3 .3 ];
2496 for k=35:99 cTRACE = [cTRACE; .75 * cTRACE(k-34,:)]; end;
2497 cDEFAULT = cTRACE;
2498 LabelX = 'X axis';
2499 LabelY = 'Y axis (Left)';
2500 LabelYr = 'Y axis (Right)';
2501 Titulo = '';
2502 LiNueva = '';
2503 NombreF = 'plt';
2504 Xlim = 'default';
2505 Ylim = 'default';
2506 YlimR = 'default';
2507 Xscale = 'linear'; Xsc = 'LinX';
2508 Yscale = 'linear'; Ysc = 'LinY';
2509 Quiv = 0;
2510 cabeQ = [.3 .3];
2511 Reja = 'on';
2512 Mbar = 0;
2513 Xslide = 0;
2514 ayudaF = '';
2515 cFile = '#';
2516 ENApre = ones(1,2);
2517 ENAcur = ones(1,99);
2518 DISras = 0;
2519 estilo = 0;
2520 marca = 0;
2521 AXr = 0;
2522 Derecho = [];
2523 DuaC = 0;
2524 TIDcback = '';
2525 Ridcol = 0;
2526 Mcaja = [1 1 1 1 0 1 1 1 1];
2527 RASid = reshape(sprintf('Line%2d',1:99),6,99)';
2528 TRACEmk = 0;
2529 Xstring = '';
2530 Ystring = '';
2531 moveCB = '';
2532 axisCB = '';
2533 aConex = 1;
2534 SubPlot = 0;
2535 NoCursor = 0;
2536 GridEr = 'norm';
2537 aLp = {}; aLv = {};
2538 aRp = {}; aRv = {};
2539 lLp = {}; lLv = {};
2540 lRp = {}; lRv = {};
2541 lXp = {}; lXv = {};
2542 sz = posFIG([3 4 3 4]);
2543 posAX = [.1429 .0933 .8329 .8819];
2544 posPICO = [.0071 .0441 .0286 .0343];
2545 posVALY = [.0071 .0060 .0286 .0343];
2546 posDEL = [.0386 .0194 .0300 .0457];
2547 posSLDR = [.0071 .0080 .1250 .0200];
2548 posCXL = [.1386 .0095 .0200 .0410];
2549 posC1X = [.1643 .0076 .1000 .0450];
2550 posC2X = [.2686 .0076 .1000 .0450];
2551 posCYL = [.7609 .0095 .0200 .0410];
2552 posC1Y = [.7865 .0076 .1000 .0450];
2553 posC2Y = [.8908 .0076 .1000 .0450];
2554 posAX2 = [.0070 .0870 .0580 .0000];
2555
2556 Sfuente = (196-get(0,'screenpix'))/10;
2557 if sum(lower(varargin{1})) == 310
2558 FIG = varargin{2}; figure(FIG); set(FIG,'vis','of');
2559 else FIG = figure('menu','none','number','off','Back','off','vis','of');
2560 end;
2561 set(FIG,'PaperPositionMode','auto','invert','off','PaperOrient','land',...
2562 'PaperUnits','norm','DoubleBuf','on','Invert','on');
2563 AX = axes('units','nor','fontsi',Sfuente,'Tag','click');
2564 Volv1 = []; nt = 0;
2565 kparam = [];
2566 k = 1;
2567 pp = 1;
2568 while k<=nargin
2569 absc = varargin{k}; k=k+1;
2570 if ischar(absc)
2571 if k>nargin
2572 disp('Error using ==> plt. Not enough input arguments.');
2573 disp('For help on using plt, type "help plt"');
2574 eval('plt(''helpv'',0);');
2575 return;
2576 end;
2577 kparam = [kparam k-1 k];
2578 absc = lower(absc); yy = varargin{k}; k=k+1;
2579 pfx = zeros(1,5);
2580 while 1
2581 b = findstr(absc(1),'+-<>.');
2582 if isempty(b) break; end;
2583 pfx(b) = 1; absc(1) = [];
2584 end;
2585 switch sum(absc)
2586 case 546, Titulo = yy;
2587 case 442, Xlim = yy;
2588 case 443, Ylim = yy;
2589 case 557, if absc(1)=='y' YlimR = yy; AXr = 1; else cXYax = yy; end;
2590 case 632, LabelX = yy;
2591 case 633, LabelY = yy;
2592 case 747, LabelYr = yy; AXr = 1;
2593 case 542, Derecho = yy; AXr = 1;
2594 case 752, DuaC = yy;
2595 case 727, NombreF = yy;
2596 case 640, cPLTbk = yy;
2597 case 614, cFIGbk = yy;
2598 case 626, cTRACE = yy;
2599 case 621, cDELTA = yy;
2600 case 654, cXYlbl = yy;
2601 case 769, cCRSR = yy;
2602 case 521, if any(yy<0) GridEr = 'xor'; end;
2603 cGRID = abs(yy);
2604 case 676, if iscell(yy) estilo = char(yy); else estilo = yy; end;
2605 case 757, if iscell(yy) marca = char(yy); else marca = yy; end;
2606 case 732, if iscell(yy) RASid = char(yy); else RASid = yy; end;
2607 case 743, if length(yy)==1 & yy yy = [yy (yy+.9)/2 .9]; end;
2608 TRACEmk = yy;
2609 case 638, ENAcur = yy;
2610 case 847, DISras = yy;
2611 case 885, if ~yy(3) yy(3) = yy(4)/.944; elseif ~yy(4) yy(4) = yy(3)*.944; end;
2612 posFIG = yy;
2613 posFIGd = 0;
2614 case 775, axisPOS = yy(1:4);
2615 switch length(yy) case 5, idPOS(3)=yy(5); case 8, idPOS=yy(5:8); end;
2616 case 821, TIDcback = yy;
2617 case 975, Ridcol = yy;
2618 case 783, Xstring = yy;
2619 case 784, Ystring = yy;
2620 case 873, LiNueva = yy;
2621 case 635, ENApre = yy;
2622 case 668, Quiv = yy; if min(yy)<2 disp('No quiver tail position '); return; end;
2623 case 515, cabeQ = yy;
2624 case 841, ayudaF = yy;
2625 case 959, cFile = yy;
2626 case 846, cPLTbk = get(0,'defaultaxescolor'); cGRID = .4*cPLTbk + .3;
2627 cFIGbk = get(0,'defaultfigurecolor');
2628 cXYax = get(0,'defaultaxesxcolor'); cXYlbl = cXYax;
2629 cTRACE = get(0,'defaultaxescolororder');
2630 if length(yy(1,:))==3 cTRACE = [cTRACE; yy]; end;
2631 case 636, moveCB = yy;
2632 case 634, axisCB = yy;
2633 case 867, aConex = yy;
2634 case 777, SubPlot = yy;
2635 case 310,
2636 case 780, kq = 0;
2637 while kq < length(yy)
2638 kq = kq + 1;
2639 switch yy(kq)
2640 case 'T', Reja = 'off';
2641 case 'M', Mbar = 1;
2642 case 'X', Xsc = 'LogX'; Xscale = 'Log';
2643 case 'Y', Ysc = 'LogY'; Yscale = 'Log';
2644 case 'S', Xslide = 1;
2645 case 'N', NoCursor = 1;
2646 case '-', kq = kq + 1; km =findstr(yy(kq),'HXYGPFMZRA');
2647 if length(km) if km==10 Mcaja=0; else Mcaja(km)=0; end; end;
2648 case '+', kq = kq + 1; km =findstr(yy(kq),'HXYGPFMZRA');
2649 if length(km) if km==10 Mcaja=ones(1,9);
2650 else if pp & km~=5 Mcaja=0; pp=0; end;
2651 Mcaja(km)=1;
2652 end;
2653 end;
2654 end;
2655 end;
2656 otherwise,
2657 if sum(pfx)
2658 if pfx(1) aLp = [aLp {absc}]; aLv = [aLv {yy}]; end;
2659 if pfx(2) aRp = [aRp {absc}]; aRv = [aRv {yy}]; end;
2660 if pfx(3) lLp = [lLp {absc}]; lLv = [lLv {yy}]; end;
2661 if pfx(4) lRp = [lRp {absc}]; lRv = [lRv {yy}]; end;
2662 if pfx(5) lXp = [lXp {absc}]; lXv = [lXv {yy}]; end;
2663 else
2664 if iscell(yy)
2665 if length(yy)==length(Volv1)
2666 absc = {absc};
2667 yy = yy(:);
2668 else fprintf('Warning: For parameter %s, found %d elements but expected %d\n',absc,length(yy),length(Volv1));
2669 end;
2670 end;
2671 set(Volv1,absc,yy);
2672 end;
2673 end;
2674 else
2675 if k<=nargin yy = varargin{k}; else yy = 'a'; end;
2676 if ~isreal(absc) yy = imag(absc); absc = real(absc);
2677 elseif isnumeric(yy) k = k+1;
2678 else yy=absc; absc=1:length(yy);
2679 end;
2680 nxt = length(Volv1) + 1;
2681 if length(find(Quiv==nxt))
2682 a = Volv1(colaQ);
2683 x0 = get(a,'x'); x0 = transpose(x0(:));
2684 y0 = get(a,'y'); y0 = transpose(y0(:));
2685 x1 = transpose(absc(:));
2686 y1 = transpose(yy(:));
2687 rNaN = repmat(NaN,size(y1));
2688 x01 = x0+x1; y01 = y0+y1;
2689 a = x01-cabeQ(1)*(x1+cabeQ(2)*y1);
2690 b = x01-cabeQ(1)*(x1-cabeQ(2)*y1);
2691 absc = [x0; x01; rNaN; a; x01; b; rNaN];
2692 a = y01-cabeQ(1)*(y1-cabeQ(2)*x1);
2693 b = y01-cabeQ(1)*(y1+cabeQ(2)*x1);
2694 yy = [y0; y01; rNaN; a; y01; b; rNaN];
2695 absc = absc(:); yy = yy(:);
2696 ENAcur(nxt) = 0;
2697 nxt = 0;
2698 end;
2699 H = line(absc,yy); Volv1 = [Volv1; H]; nt = nt + length(H);
2700 if nxt colaQ = nt; end;
2701 end;
2702 end;
2703
2704 if iscell(Ylim) YlimR = Ylim{2}; Ylim = Ylim{1}; AXr = 1; end;
2705 nSP = length(SubPlot) - 1;
2706 if (iscell(LabelX) | iscell(Xlim)) & ~nSP & nt>1 SubPlot = [100 -50 100]; nSP = 2; end;
2707 if iscell(LabelX) LabelXr = LabelX{2}; LabelX = LabelX{1}; else LabelXr = 'X axis'; end;
2708 if iscell(Xlim) Xlimr = Xlim{2}; Xlim = Xlim{1}; else Xlimr = 'default'; end;
2709
2710 nSPl = nSP;
2711 nSPr = 0;
2712 SPw = 1;
2713 if nSP
2714 SubPlot = SubPlot/100;
2715 k = find(SubPlot<0);
2716 if length(k) SPw = -SubPlot(k);
2717 SubPlot(k) = []; nSP = nSP-1;
2718 nSPr = nSP + 2 - k; nSPl = nSP - nSPr;
2719 end;
2720 end;
2721 nID = nt - nSP;
2722 if nID>99 & RASid disp(sprintf('Max # of traceIDs = %d',99)); return; end;
2723 if ~iscell(LabelY) LabelY = {LabelY}; end;
2724 if length(LabelY) >= nSP+2 LabelYr = LabelY{nSP+2}; AXr = 1; end;
2725 setappdata(FIG,'params',varargin(kparam));
2726 k = sum(Ridcol);
2727 if k Ridcol = [nID-k Ridcol]; else Ridcol = nID; end;
2728 ntid = max(Ridcol);
2729 ncol = length(Ridcol);
2730 if ncol>1 & all(axisPOS == o4) & all(idPOS == o4)
2731 idPOS(3) = ncol;
2732 axisPOS = [.4 + ncol/2, 1, (210-11*ncol-ncol^2)/200, 1];
2733 end;
2734 if all(idPOS == o4) & (nt<6 | isempty(LabelY{1})) & ~nSP
2735 idPOS(3) = 1.2;
2736 end;
2737 fsep = length(findstr(cFile,filesep));
2738 if length(cFile) & ~fsep
2739 foobar = 0;
2740 if exist('foobar')
2741 liy = feval('dbstack');
2742 if length(liy)
2743 lix = liy(end).name;
2744 nq = findstr('(',lix);
2745 if length(nq) lix = lix(1:nq(1)-2); end;
2746 np = findstr(filesep,lix);
2747 if length(np) np=np(end); else np=0; end;
2748 if length(lix)-np>30 & length(liy)>1 lix = liy(end-1).name; end;
2749 liy = feval('which',lix);
2750 end;
2751 else liy = GetExe;
2752 end;
2753 [pth, name] = fileparts(liy);
2754 if cFile(1) == '#' cFile = [name 'Color']; end;
2755 cFile = fullfile(pth,[cFile '.mat']);
2756 end;
2757 if fsep cFile = [cFile '.mat']; end;
2758 if exist(cFile) == 2
2759 load(cFile);
2760 end;
2761 if length(ENAcur)<nt ENAcur = [ENAcur ones(1,nt-length(ENAcur))]; end;
2762 if length(DISras)<nt DISras = [DISras zeros(1,nt-length(DISras))]; end;
2763 nC = length(cTRACE(:,1));
2764 if length(Titulo)
2765 axisPOS = axisPOS .* [1 1 1 .96];
2766 ntx = findstr('[TexOff]',Titulo);
2767 if length(ntx)==1
2768 Titulo(ntx:ntx+7) = [];
2769 title(Titulo,'color',cXYlbl,'HandleV','on','interp','none');
2770 else title(Titulo,'color',cXYlbl,'HandleV','on');
2771 end;
2772 end;
2773 setappdata(AX,'DualCur',DuaC);
2774 if AXr & nID>1
2775 if isempty(Derecho) Derecho = nID; end;
2776 axisPOS = axisPOS .* [1 1 .94 1];
2777 if ischar(YlimR)
2778 mn = inf; mx = -inf;
2779 for k=Derecho
2780 absc = get(Volv1(k),'y'); mn = min(mn,min(absc)); mx = max(mx,max(absc));
2781 end;
2782 df=(mx-mn)/20; YlimR=[mn-df mx+df];
2783 if ~diff(YlimR) YlimR = [mn mn+max(1e-12,mn*1e-12)]; end;
2784 end;
2785 if length(Derecho)==1 yclr = cTRACE(mod(Derecho-1,nC)+1,:); else yclr = cXYax; end;
2786 AXr = axes('units','nor','fontsi',Sfuente,'YAxisLoc','right','yli',YlimR,...
2787 'color',cPLTbk,'xcol',cXYax,'ycol',yclr,'xtick',[]);
2788 if ~aConex LabelYr = ['\div ' LabelYr ' \div']; end;
2789 ylabel(LabelYr,'color',yclr,'HandleV','on','ButtonD','plt click link;');
2790 set(Volv1(Derecho),'par',AXr);
2791 axes(AX);
2792 AXrl = [AX AXr];
2793 else AXrl = AX; set(AX,'Box','On');
2794 end;
2795 mrk = repmat('+',1,nt);
2796 mrk(Derecho) = 'o';
2797 if DuaC
2798 if length(find(DuaC==Derecho)) mrk(DuaC)='s'; else mrk(DuaC) = '*'; end;
2799 end;
2800 ceq = isequal(cCRSR,CURcDEF); cEXcaja = cCRSR;
2801 if ceq & sum(cPLTbk)>2 cEXcaja=1-cEXcaja; cCRSR=1-cCRSR; end;
2802 curclr = [.7 .7 .7; 0 0 0; cEXcaja; cDELTA];
2803 ENAcurS = sum(ENAcur(1:nt));
2804 if ceq & ENAcurS>1 cCRSR = [0 0 0]; end;
2805 for k=1:nt set(Volv1(k),'color',cTRACE(mod(k-1,nC)+1,:));
2806 if ENAcur(k) curclr=[curclr; cCRSR]; else set(Volv1(k),'Tag','SkipCur'); end;
2807 end;
2808 if estilo if length(estilo(:,1)) < nt estilo=estilo'; end;
2809 for k=1:nt
2810 if length(findstr(estilo(k,1),'+o*.xsd^v<>ph'))
2811 set(Volv1(k),'LineStyle','none','Marker',estilo(k,1));
2812 else set(Volv1(k),'LineStyle',estilo(k,:)); end;
2813 end;
2814 end;
2815 if marca if length(marca(:,1)) < nt marca=marca'; end;
2816 for k=1:nt set(Volv1(k),'Marker',marca(k,:)); end;
2817 end;
2818 for k=1:nt if DISras(k) set(Volv1(k),'vis','of'); end; end;
2819
2820 Ret1a = Volv1;
2821 axS = [];
2822 if nSP
2823 if posFIGd posFIG([3 4]) = [840 570]; end;
2824 ySP = .11; ySPr = ySP;
2825 ySP = cumsum([ySP (1-ySP)*SubPlot(1:nSPl+1)]);
2826 hSP = diff(ySP) - .03; ySP = ySP + .012;
2827 dx = ((AXr>0)*.025 - .07) * (nSPr>0);
2828 posAX = [posAX(1) ySP(1) (posAX(3)+dx)*SPw hSP(1)];
2829 dx = posFIG(3); dx1 = 64/dx; dx2 = 14/dx; dx3 = 67/dx; dx4 = 19/dx;
2830 dy = posFIG(4); dy1 = 20/dy; y1a = .0076; y2a = y1a + 24/dy;
2831 x1 = .1386; x2 = x1+dx4; x3 = x2+dx3; x4 = x2+nSPl*dx3;
2832 posCXL = [x1 y2a dx2 dy1];
2833 posCYL = [x1 y1a dx2 dy1];
2834 posC1X = [x2 y2a dx1 dy1];
2835 posC2X = [x3 y2a dx1 dy1];
2836 posC1Y = [x4 y1a dx1 dy1];
2837 posC2Y = posC1Y + [dx3 0 0 0];
2838 if nSPr
2839 ySPr = cumsum([ySPr (1-ySPr)*SubPlot(nSPl+2:end)]);
2840 hSPr = diff(ySPr) - .03; ySPr = ySPr + .012;
2841 SPx = sum(posAX([1 3])) + .075;
2842 x1 = SPx-.03; x2 = x1+dx4; x3 = x2+dx3; x4 = x2+(nSPr-1)*dx3;
2843 posCXLr = [x1 y2a dx2 dy1];
2844 posCYLr = [x1 y1a dx2 dy1];
2845 posC1Xr = [x2 y2a dx1 dy1];
2846 posC2Xr = [x3 y2a dx1 dy1];
2847 posC1Yr = [x4 y1a dx1 dy1];
2848 posC2Yr = posC1Yr + [dx3 0 0 0];
2849 p2r = [posCXLr;posCYLr;posC1Xr;posC2Xr;posC1Yr;posC2Yr];
2850 end;
2851 for k=1:nSP
2852 l = Volv1(nt+k-nSP);
2853 Ret1a(nt+k-nSP) = 0;
2854 c = get(l,'color');
2855 a = axes('ycol',c,'xcol',c);
2856 setappdata(a,'Lhandles',l);
2857 set(l,'par',a);
2858 if length(LabelY)>k ylabel(LabelY{k+1}); end;
2859 if k == nSPl+1 xlabel(LabelXr); end;
2860 axS = [axS a];
2861 end;
2862 end;
2863 set(AXrl,'pos',posAX.*axisPOS,'Xscale',Xscale,'Yscale',Yscale);
2864 if ischar(Ylim)
2865 Ylim = get(AX,'yli');
2866 end;
2867 Ret1a(find(~Ret1a)) = [];
2868 setappdata(AX,'Lhandles',Ret1a);
2869 setappdata(FIG,'Lhandles',Volv1);
2870 axData = [AX axS];
2871 if AXr axData = [axData AXr]; end;
2872 setappdata(FIG,'axis',axData);
2873
2874 pb = [posPICO;posVALY;posDEL];
2875 if Xslide
2876 posAX2(2) = posAX2(2) + .028; pb(:,2) = pb(:,2) + .028; pb = [pb; posSLDR];
2877 end;
2878 cador = plt('cursor',AXrl,'init',...
2879 [posCXL;posCYL;posC1X;posC2X;posC1Y;posC2Y;pb],...
2880 curclr,'', mrk, 0.8*Sfuente,'','on',[],LiNueva);
2881
2882 set(findobj(gcf,'style','push','str','D'),'use',cDEFAULT,'tag',cFile);
2883 rasHT = sprintf('plt(''cursor'',%d,',cador);
2884 set(AXrl,'use',cador);
2885 Izqu = setdiff(1:nt-nSP,Derecho);
2886 nIzqu = length(Izqu);
2887 if (AXr | nSP) & nIzqu==1
2888 yclr = cTRACE(mod(Izqu-1,nC)+1,:); leftclr=yclr;
2889 else yclr = cXYax; leftclr = cXYlbl;
2890 end;
2891 set(AX,'xcol',cXYax,'ycol',yclr);
2892 if ischar(Xlim)
2893 if nIzqu Xlim = get(AX,'xli'); else Xlim = get(AXr,'xli'); end;
2894 end;
2895 [prefix xmult] = plt('metricp',max(abs((Xlim))));
2896 if ENApre(1) & xmult~=1
2897 for k=1:nt set(Volv1(k),'x',xmult*get(Volv1(k),'x')); end;
2898 LabelX = [prefix LabelX];
2899 else xmult = 1;
2900 end;
2901 set(AXrl,'xli',Xlim*xmult);
2902 [prefix mult] = plt('metricp',max(abs((Ylim))));
2903 ymult = ones(1,nt);
2904 if ENApre(2) & mult~=1
2905 for k=1:nIzqu
2906 kk = Volv1(Izqu(k));
2907 set(kk,'y',mult*get(kk,'y'));
2908 ymult(Izqu(k)) = mult;
2909 end;
2910 LabelY{1} = [prefix LabelY{1}];
2911 else mult = 1;
2912 end;
2913 set(AX,'yli',Ylim*mult);
2914 setappdata(FIG,'xymult',[xmult ymult]);
2915 xlabel(LabelX,'color',cXYlbl,'HandleV','on');
2916 hYlab = ylabel(LabelY{1},'color',leftclr,'HandleV','on');
2917 plt('cursor',cador,'set','moveCB2',[rasHT '''MVcur'');']);
2918 plt('grid',AX,'init',cGRID,GridEr);
2919 set(AX,'TickLen',(1-plt('grid',AX,Reja))*[.01 .025]);
2920 axes('pos',posCYL+[0 0 .2 0],'vis','of');
2921 text(-.02,.45,'','fontsi',Sfuente,'horiz','right','ButtonD','plt click RMS;','use','idcur');
2922 if length(Xstring)
2923 if ischar(Xstring) & Xstring(1) == '?'
2924 Xstring(1)=[];
2925 a = uicontrol('sty','edit','units','nor','pos',posC2X.*[1 1 1.7 1],'horiz','cent',...
2926 'backg',[.2 .2 .2],'foreg',[1 1 .3]);
2927 else a = text(-2.22,.45,'','color',cXYlbl);
2928 end;
2929 set(a,'fontsi',Sfuente,'tag','xstr');
2930 setappdata(a,'evl',Xstring);
2931 ch = get(FIG,'child');
2932 ch([1 end-1]) = ch([end-1 1]); set(FIG,'child',ch);
2933 end;
2934 if length(Ystring)
2935 if ischar(Ystring) & Ystring(1) == '?'
2936 Ystring(1)=[];
2937 a = uicontrol('sty','edit','units','nor','pos',posC2Y,'horiz','cent',...
2938 'backg',[.2 .2 .2],'foreg',[1 1 .3]);
2939 else a = text(.6,.45,'','color',cXYlbl);
2940 end;
2941 set(a,'fontsi',Sfuente,'tag','ystr');
2942 setappdata(a,'evl',Ystring);
2943 ch = get(FIG,'child');
2944 ch([1 end-2]) = ch([end-2 1]); set(FIG,'child',ch);
2945 end;
2946 nMenu = sum(Mcaja);
2947 aid = 0;
2948 ahi = .035*nMenu;
2949 if nID>1 & RASid
2950 h = 19*ntid;
2951 ahip = ahi * sz(2);
2952 hr = (sz(2)-85) / (h+ahip);
2953 if hr<1 ahi = ahi*hr; h = h*hr; end;
2954 aidp = idPOS.*[3 sz(2)-4-h 50 h]./sz;
2955 aid = axes('xli',[0 ncol],'yli',[-ntid 0]-.5,'color',cPLTbk,'xcol',cFIGbk,'ycol',cFIGbk,'XtickL',' ','YtickL',' ','TickLen',[0 0]','use','TraceID',...
2956 'units','nor','pos',aidp);
2957 setappdata(aid,'TIDcback',TIDcback);
2958 cRid = cPLTbk + .16*(2*(cPLTbk<.5)-1);
2959 fila = 1; col = 1;
2960 bln = 0;
2961 lpl = {'color'; 'marker'; 'linestyle'; 'linewidth'};
2962 [tn tw] = size(RASid);
2963 if nID>tn RASid = [RASid; repmat(' ',nID-tn,tw)]; end;
2964 for k=1:nID
2965 if length(find(k==Derecho)) cR=cRid; line(col-[1 .05],[0 0]-fila,'color',cR,'LineWidth',9);
2966 else cR=cPLTbk;
2967 end;
2968 s = RASid(k,:);
2969 if all(s==' ') bln=bln+1; continue; end;
2970 d = text(col-.93,-fila,s);
2971 ms = sprintf('plt(''click'',[%d %d]);',8192*Volv1(k),8192*d);
2972 set(d,'fontsi',Sfuente,'fontw','bol','color',cTRACE(mod(k-1,nC)+1,:),'ButtonD',ms);...
2973 if TRACEmk
2974 mk = line(TRACEmk,TRACEmk*0-k,lpl,get(Volv1(k),lpl),'ButtonD',ms);
2975 setappdata(d,'mk',mk);
2976 if TRACEmk(1)<.25 set(d,'color',cR); end;
2977 else mk = [];
2978 end;
2979 if DISras(k) set(d,'fonta','ita','fontw','nor'); set(mk,lpl,{[0 .3 .3] 'none' '-' 9}); end;
2980 fila = fila+1;
2981 if fila>Ridcol(col) col=col+1; fila=1; end;
2982 end;
2983 if bln & ncol==1
2984 dy = aidp(4) * (1 - (nID-bln)/nID);
2985 set(aid,'yli',[bln-nID 0]-.5,'pos',aidp+[0 dy 0 -dy]);
2986 end;
2987 end;
2988 if nMenu
2989 posAX2(4) = ahi; c = (cXYax + cFIGbk)/2;
2990 amb = axes('units','nor','pos',posAX2,'yli',[-nMenu 0]-.45,'Box','On','XaxisLoc','top',...
2991 'color',cFIGbk,'xcol',c,'ycol',c,'XtickL',' ','YtickL',' ','TickLen',[0 0]','Tag','MenuBox');
2992 b=0; t=[];
2993 txt = { 'Help', Xsc, Ysc, 'Grid', 'Print', 'Menu', 'Mark', 'Zout', 'XY\leftrightarrow'};
2994 btn = { 'plt(''helpv'',1);'; 'plt(''click'',''TGLlogx'');'; 'plt(''click'',''TGLlogy'');'; 'plt(''click'',''TGLgrid'');'; 'plt(''hcpy'',''init'',gcf);'; 'plt(''click'',''TGLmenu'');'; 'plt(''click'',''mark'');'; 'plt(''click'',''ZoomOut'');'; '' };
2995 for k=1:length(Mcaja)
2996 if Mcaja(k)
2997 b=b-1; t = [t text(.5,b,txt{k},'interp','tex')]; bt = btn{k};
2998 if isempty(bt) bt = [rasHT '''scale'',''old'');']; end;
2999 set(t(end),'ButtonD',bt);
3000 if k==1 set(t(1),'use',ayudaF); end;
3001 end;
3002 end;
3003 set(t,'fontsi',Sfuente,'color',cXYlbl,'horiz','cent');
3004 end;
3005 CurPri = getappdata(0,'CurMain');
3006 Hc = get(CurPri(cador),'use');
3007 set(Hc(4),'ButtonD','plt click EDIT 1;');
3008 set(Hc(6),'ButtonD','plt click EDIT 2;');
3009 if posFIG(1)<0 posFIG = abs(posFIG);
3010 else for k=fliplr(findobj('Type','figure')')
3011 if get(k,'pos') == posFIG posFIG = posFIG + [30 25 0 0]; end;
3012 end;
3013 end;
3014 set(FIG,'pos',posFIG,'Name',NombreF,'color',cFIGbk,'CloseReq',...
3015 [rasHT '''clear'');delete(findobj(''type'',''fig'',''user'',gcf));closereq;']);
3016 if Mbar plt('click','TGLmenu'); end;
3017 ac = plt('cursor',cador,'get','activeLine');
3018 t = Volv1(ac); x=get(t,'x'); absc=get(t,'y'); k=round(length(x)/2);
3019 set(AX,aLp,aLv);
3020 set(get(AX,'Ylabel'),lLp,lLv);
3021 set(get(AX,'Xlabel'),lXp,lXv);
3022 if AXr set(AXr,aRp,aRv);
3023 set(get(AXr,'Ylabel'),lRp,lRv);
3024 end;
3025 xyll = get(AX,{'xli' 'yli'});
3026 plt('cursor',cador,'mainCur',k,x(k),absc(k),0,get(t,'color'));
3027 setappdata(AX,'xstr',findobj(gcf,'tag','xstr'));
3028 setappdata(AX,'ystr',findobj(gcf,'tag','ystr'));
3029 set(AX,{'xli' 'yli'},xyll);
3030 if DuaC & ~DISras(DuaC) plt('cursor',cador,'auxCur');
3031 else plt('cursor',cador,'set','aux','off');
3032 end;
3033 v = 'off';
3034 for k=1:nIzqu
3035 if strcmp(get(Volv1(Izqu(k)),'vis'),'on') v = 'on'; break; end;
3036 end;
3037 set(hYlab,'vis',v,'ui',uicontextmenu('call','plt hideCur;'));
3038 izquC = cPLTbk;
3039 if AXr
3040 ls = Volv1(Derecho)';
3041 set(Hc(14+Derecho),'par',AXr,'erase','xor');
3042 v = 'off';
3043 for k=1:length(ls)
3044 if strcmp(get(ls(k),'vis'),'on')
3045 v = 'on';
3046 izquC = 'none';
3047 break;
3048 end;
3049 end;
3050 set(AXr,'vis',v);
3051 end;
3052 plt('cursor',cador,'MVcur');
3053 if length(moveCB) plt('cursor',cador,'set','moveCB',moveCB); end;
3054 if length(axisCB) plt('cursor',cador,'set','axisCB',axisCB); end;
3055 set(AX,'color',izquC);
3056 cidS = cador;
3057 if nSP
3058 if aid & all(idPOS([1 2 4]) == [1 1 1])
3059 set(aid,'units','nor');
3060 p = get(aid,'pos');
3061 p(2) = ySP(2)-p(4)-.025;
3062 if p(2) < sum(posAX2([2 4]))+.015
3063 p(2) = posAX2(2); posAX2(2) = p(2) + p(4) + .02;
3064 set(amb,'pos',posAX2);
3065 end;
3066 set(aid,'pos',p);
3067 end;
3068 h = plt('cursor',cador,'get','obj');
3069 q = [-1 .1 .1 .1]; u = [q;q;q;q];
3070 py1 = get(h(5),'pos'); p1 = [u;py1;u];
3071 p = {'pos' 'Xlim' 'color' 'Xscale' 'FontSize' 'TickLength' 'Box'};
3072 v = get(AX,p);
3073 if ischar(v{3}) v{3} = get(AXr,'color'); end;
3074 for k=1:nSPl
3075 v{1}([2 4]) = [ySP(k+1) hSP(k+1)];
3076 set(axS(k),p,v);
3077 p1(5,1) = p1(5,1) - dx3;
3078 cidS = [cidS plt('cursor',axS(k),'init',p1,'','','+',8)];
3079 set(axS(k),'use',cidS(end));
3080 end;
3081 if nSPr
3082 v{1}([1 3]) = [SPx .98-SPx]; p2r = [p2r;q;q;q];
3083 if ischar(Xlimr) k = get(Volv1(end),'x'); v{2} = [min(k) max(k)];
3084 else v{2} = Xlimr;
3085 end;
3086 for k=1:nSPr
3087 kr = k+nSPl;
3088 v{1}([2 4]) = [ySPr(k) hSPr(k)];
3089 set(axS(kr),p,v);
3090 cidS = [cidS plt('cursor',axS(kr),'init',p2r,'','','+',8)];
3091 set(axS(kr),'use',cidS(end));
3092 if k==1 p2r([1 2 3 4 6],:) = [u;q]; end;
3093 p2r(5,1) = p2r(5,1) - dx3;
3094 end;
3095 end;
3096 creq = [];
3097 s = 'plt(''cursor'',';
3098 cidSS = {[s int2str(cidS(1))]};
3099 for k=1:nSP
3100 SS = [s int2str(cidS(k+1))];
3101 cidSS = [cidSS {SS}];
3102 creq = [creq SS ',''clear'');'];
3103 plt('grid',axS(k),'init',cGRID,GridEr);
3104 if length(Reja)==3 plt('grid',axS(k),'off'); end;
3105 end;
3106 set(FIG,'closereq',[creq get(FIG,'closereq')]);
3107 setappdata(FIG,'c',0);
3108 s1a = 'if getappdata(gcf,"c")==%d setappdata(gcf,"c",0); else setappdata(gcf,"c",getappdata(gcf,"c")+1);';
3109 s1 = sprintf(s1a,nSPl);
3110 s2 = ',"set","activeLine",0,@IDX); end';
3111 s3 = ',"set","xlim",get(gca,"xlim")); end';
3112 for k=0:nSPl
3113 if k==nSPl j=1; else j=k+2; end;
3114 plt('cursor',cidS(k+1),'set','moveCB',[s1 cidSS{j} s2]);
3115 plt('cursor',cidS(k+1),'set','axisCB',[s1 cidSS{j} s3]);
3116 end;
3117 xk = Xlim(1) + diff(Xlim)/9;
3118 [a xk] = min(abs(x-xk));
3119 plt('cursor',cador,'mainCur',xk);
3120 if nSPr
3121 s1 = sprintf(s1a,nSPr);
3122 for k=1:nSPr
3123 kr = k+nSPl+1;
3124 if k==nSPr j=nSPl+2; else j=kr+1; end;
3125 plt('cursor',cidS(kr),'set','moveCB',[s1 cidSS{j} s2]);
3126 plt('cursor',cidS(kr),'set','axisCB',[s1 cidSS{j} s3]);
3127 end;
3128 plt('cursor',cidS(nSPl+2),'mainCur',round(length(get(Volv1(end),'x'))/9));
3129 axS(nSPl+1) = [];
3130 end;
3131 set(axS,'xticklabel',[]);
3132 set(findobj(FIG,'use','idcur'),'vis','of');
3133 end;
3134 setappdata(FIG,'cid',cidS);
3135 if NoCursor plt('cursor',cador,'set','visOFF'); end;
3136 axes(AX);
3137 if length(Reja)==2 plt('grid',AX); end;
3138 set(FIG,'vis','on');
3139 drawnow;
3140 end;
3141
3142 function fixMark()
3143 markR = findobj(gcf,'tag','markR')';
3144 if isempty(markR) return; end;
3145 for l = markR
3146 u = get(l,'use');
3147 t = u(1); v2 = u(2); axr = u(3); ylim = u(4:5); rlim = u(6:7);
3148 if ishandle(t) p = get(t,'pos'); else p = [0 0]; end;
3149 absc = [get(l,'y') p(2)];
3150 absc = rlim(1) + diff(rlim) * (absc - ylim(1)) / diff(ylim);
3151 rlim = get(axr,'yli'); ylim = get(v2,'yli');
3152 absc = ylim(1) + diff(ylim) * (absc - rlim(1)) / diff(rlim);
3153 set(l,'y',absc(1),'use',[u(1:3) ylim rlim]);
3154 if ishandle(t) p(2) = absc(2); set(t,'pos',p); end;
3155 end;
3156
3157 function r2 = plt2nd(v)
3158 [r1 r2] = plt(v{:});
3159
3160 function r = get8192(h,prop)
3161 r = get(h/8192,prop);
3162
3163 function evalQ(a)
3164 if ischar(a) a = strrep(a,'"','''');
3165 eval(a);
3166 elseif iscell(a) feval(a{:});
3167 else feval(a);
3168 end;
3169
3170 function evalRep(a,rep)
3171 if ischar(a) for k=1:2:length(rep) a = strrep(a,rep{k},rep{k+1}); end;
3172 a = strrep(a,'"','''');
3173 eval(a);
3174 elseif iscell(a) feval(a{:});
3175 else feval(a);
3176 end;
3177
3178 function r = evalRep2(a,rep)
3179 if ischar(a) for k=1:2:length(rep) a = strrep(a,rep{k},rep{k+1}); end;
3180 a = strrep(a,'"','''');
3181 r = eval(a);
3182 elseif iscell(a) r = feval(a{:});
3183 else r = feval(a);
3184 end;
3185
3186 function v = s2d(s)
3187 v = sscanf(s,'%f');
3188
3189 function v = s2i(s)
3190 v = sscanf(s,'%d');