0001 function [p] = gui_topo_animate(command,p)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 if ~exist('command','var'), command = 'init'; end
0025
0026 switch command,
0027
0028 case 'init',
0029
0030 if exist('p','var'),
0031 if ~isempty(p),
0032 ANIM = INIT(p);
0033 end
0034 else
0035 ANIM = INIT;
0036 end
0037
0038 case 'animate',
0039
0040 ANIM = get(gcbf,'Userdata');
0041 if isempty(ANIM),
0042 ANIM = get(gcf,'Userdata');
0043 end
0044
0045
0046
0047 views = get(ANIM.View,'String');
0048 ANIM.p.topoView = lower(char(views(get(ANIM.View,'Value'))));
0049
0050
0051
0052
0053
0054 axsibs = get(ANIM.axis,'Children');
0055 for i=1:length(axsibs),
0056 type = get(axsibs(i),'Type');
0057 if isequal(type,'patch'),
0058 ANIM.Hp = axsibs(i);
0059 end
0060 end
0061
0062
0063
0064 ANIM = toggle_visible(ANIM);
0065 set(ANIM.Hp,'EraseMode','normal');
0066 figure(ANIM.gui);
0067
0068
0069
0070
0071 start_msec = str2num(get(ANIM.Start,'string'));
0072 finish_msec = str2num(get(ANIM.Finish,'string'));
0073 step_msec = str2num(get(ANIM.Step,'string'));
0074
0075
0076
0077
0078 [ sample, timeArray ] = extract_data(ANIM);
0079
0080
0081
0082
0083 step = step_msec/sample.rate;
0084 stepREM = step - fix(step);
0085 if stepREM,
0086 nointerp = 0;
0087
0088 warning('GUI_TOPO_ANIMATE: Cannot interpolate for steps ~= sample rate\n');
0089 step = 1;
0090 set(ANIM.Step,'string',sprintf('%7.2f',sample.rate));
0091 else
0092 nointerp = 1;
0093 end
0094
0095
0096
0097
0098
0099 [ index, point ] = NearestXYArrayPoint( timeArray, start_msec, 'exact' );
0100 if isempty(index),
0101 [ index, point ] = NearestXYArrayPoint( timeArray, start_msec );
0102 end
0103 start_index = index;
0104 start_point = point;
0105
0106 [ index, point ] = NearestXYArrayPoint( timeArray, finish_msec, 'exact' );
0107 if isempty(index),
0108 [ index, point ] = NearestXYArrayPoint( timeArray, finish_msec );
0109 end
0110 finish_index = index;
0111 finish_point = point;
0112
0113 set(ANIM.Start,'value',start_point);
0114 set(ANIM.Start,'string',sprintf('%7.2f',start_point));
0115 set(ANIM.Finish,'value',finish_point);
0116 set(ANIM.Finish,'string',sprintf('%7.2f',finish_point));
0117
0118
0119
0120
0121 if isequal(start_index,finish_index),
0122
0123
0124
0125
0126 ANIM = voltage_scale(ANIM,start_index,finish_index);
0127 caxis([ANIM.p.minimumIntensity ANIM.p.maximumIntensity]);
0128 colorbar
0129
0130 t = start_index;
0131
0132 ANIM = update_topo(ANIM,t,step);
0133
0134 ANIM = toggle_visible(ANIM);
0135 [p] = ANIM.p;
0136 return;
0137
0138 elseif start_index > finish_index,
0139 ANIM = toggle_visible(ANIM);
0140 error('GUI_TOPO_ANIMATE: Finish < Start!\n');
0141 end
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 ANIM = voltage_scale(ANIM,start_index,finish_index);
0152 caxis([ANIM.p.minimumIntensity ANIM.p.maximumIntensity]);
0153 colorbar
0154
0155
0156 doMovie = ANIM.Movie;
0157 if doMovie,
0158 movieFrameIndex = 0;
0159
0160 rect = get(ANIM.gui,'Position');
0161 rect(1:2) = [0 0];
0162 end
0163
0164 for t=start_index : step : finish_index,
0165
0166 ANIM = update_topo(ANIM,t,step);
0167
0168
0169 if doMovie,
0170 movieFrameIndex = movieFrameIndex + 1;
0171 movieMatrix(:,movieFrameIndex) = getframe(ANIM.gui,rect);
0172 end
0173 end
0174 ANIM = toggle_visible(ANIM);
0175
0176
0177 if doMovie,
0178
0179
0180 playtimes = 10;
0181 framesPerSecond = 10;
0182
0183 movieFigure = figure('NumberTitle','off','Name','Movie Playback (10 FPS, 10 LOOPS)',...
0184 'PaperType','A4','PaperUnits','centimeters');
0185
0186 axis off;
0187
0188 movie(movieFigure,movieMatrix,playtimes,framesPerSecond,rect);
0189
0190 selection = 'replay';
0191 while isequal(selection,'replay'),
0192
0193 [selectedButton,dlgShown]=uigetpref('eeg_toolbox','saveTopoMovie',...
0194 'Movie Controls',...
0195 'Replay, save or close this movie?',...
0196 {'replay','save','close';'Replay','Save','Close'},...
0197 'CheckboxString','save this preference',...
0198 'DefaultButton','Close');
0199
0200
0201 if dlgShown,
0202 selection = selectedButton;
0203 else
0204 selection = getpref('eeg_toolbox','saveTopoMovie');
0205 end
0206
0207 switch selection,
0208 case 'replay',
0209 movie(movieFigure,movieMatrix,playtimes,framesPerSecond,rect);
0210 case 'save',
0211
0212 aviFileName = uiputfile('*.avi','Save Movie As .avi');
0213 if aviFileName,
0214 movie2avi(movieMatrix,aviFileName,'quality',100);
0215 filename = strcat(pwd,filesep,aviFileName);
0216 fprintf('Saved movie to %s\n',filename);
0217 end
0218 close(movieFigure);
0219 otherwise,
0220 close(movieFigure);
0221 end
0222 end
0223
0224 end
0225
0226 [p] = ANIM.p;
0227
0228
0229 otherwise,
0230
0231 end
0232
0233 return
0234
0235
0236
0237
0238
0239
0240
0241
0242 function [ sample, timeArray, Cdata ] = extract_data(ANIM),
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252 if ANIM.p.mesh.current & ~isempty(ANIM.p.mesh.data),
0253
0254 if ANIM.p.mesh.current > length(ANIM.p.mesh.data.meshtype),
0255
0256 sample.rate = ANIM.p.volt.sampleMsec;
0257 sample.point = ANIM.p.volt.samplePoint;
0258 sample.time = ANIM.p.volt.sampleTime;
0259 timeArray = ANIM.p.volt.timeArray(:,1);
0260 Cdata = ANIM.p.volt.data';
0261 return
0262 end
0263
0264 meshtype = lower(ANIM.p.mesh.data.meshtype{ANIM.p.mesh.current});
0265 switch meshtype,
0266 case 'elec',
0267
0268 sample.rate = ANIM.p.volt.sampleMsec;
0269 sample.point = ANIM.p.volt.samplePoint;
0270 sample.time = ANIM.p.volt.sampleTime;
0271 timeArray = ANIM.p.volt.timeArray(:,1);
0272 Cdata = ANIM.p.volt.data';
0273 case 'scalp',
0274
0275 sample.rate = ANIM.p.volt.sampleMsec;
0276 sample.point = ANIM.p.volt.samplePoint;
0277 sample.time = ANIM.p.volt.sampleTime;
0278 timeArray = ANIM.p.volt.timeArray(:,1);
0279
0280 nvert = size(ANIM.p.mesh.data.vertices{ANIM.p.mesh.current},1);
0281 [s1,s2] = size(ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current});
0282 if isequal(nvert,s1),
0283 Cdata = ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current};
0284 else,
0285
0286 Cdata = ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current}';
0287 end
0288 otherwise
0289
0290
0291 sample.rate = ANIM.p.mesh.data.timeseries{ANIM.p.mesh.current}(2) - ANIM.p.mesh.data.timeseries{ANIM.p.mesh.current}(1);
0292 sample.point = ANIM.p.mesh.samplePoint;
0293 sample.time = ANIM.p.mesh.sampleTime;
0294 timeArray = ANIM.p.mesh.data.timeseries{ANIM.p.mesh.current};
0295
0296 nvert = size(ANIM.p.mesh.data.vertices{ANIM.p.mesh.current},1);
0297
0298 [s1,s2] = size(ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current});
0299 if isequal(nvert,s1),
0300 Cdata = ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current};
0301 else,
0302
0303 Cdata = ANIM.p.mesh.data.Cdata{ANIM.p.mesh.current}';
0304 end
0305 end
0306 else
0307
0308 sample.rate = ANIM.p.volt.sampleMsec;
0309 sample.point = ANIM.p.volt.samplePoint;
0310 sample.time = ANIM.p.volt.sampleTime;
0311 timeArray = ANIM.p.volt.timeArray(:,1);
0312 Cdata = ANIM.p.volt.data';
0313 end
0314
0315 return
0316
0317
0318
0319
0320 function [ ANIM ] = update_topo(ANIM,t,step),
0321
0322 [ sample, timeArray, Cdata ] = extract_data(ANIM);
0323
0324
0325
0326 if step > 1,
0327 Cdata = Cdata(:,t-(step-1):t);
0328 V = mean(Cdata,2);
0329 else
0330 V = Cdata(:,t);
0331 end
0332 clear Tmp;
0333
0334
0335 switch ANIM.p.mesh.data.meshtype{ANIM.p.mesh.current},
0336 case {'scalp','elec'},
0337 otherwise
0338 V = abs(V);
0339 end
0340
0341 set(ANIM.Hp,'FaceVertexCdata',V);
0342
0343
0344 switch ANIM.p.mesh.data.meshtype{ANIM.p.mesh.current},
0345 case {'scalp','elec'},
0346 ANIM.p.volt.samplePoint = t;
0347 otherwise
0348 ANIM.p.mesh.samplePoint = t;
0349 end
0350
0351 if (ANIM.p.contour.plot3D == 1),
0352 ANIM.p = eeg_plot_surf_contours(ANIM.p);
0353 end
0354
0355 drawnow;
0356
0357
0358 ANIM.p.volt.sampleTime = timeArray(t);
0359 timeString = sprintf('%8.2f msec',ANIM.p.volt.sampleTime);
0360 set(ANIM.msec,'String',timeString);
0361
0362
0363 ANIM.p.volt.sampleTime = timeArray(t);
0364 name = sprintf('Surface: %s @ %8.2f msec',ANIM.p.volt.file, ANIM.p.volt.sampleTime);
0365 set(ANIM.gui,'Name',name);
0366
0367
0368 if get(ANIM.Save,'Value'),
0369 types = get(ANIM.Type,'String');
0370 type = char(types(get(ANIM.Type,'Value')));
0371 eeg_save_graphics(ANIM.gui,type,ANIM.p,0);
0372 end
0373
0374 set(ANIM.gui,'Userdata',ANIM);
0375
0376 return
0377
0378
0379
0380
0381
0382 function [ ANIM ] = voltage_scale(ANIM,start,finish),
0383
0384 [ sample, timeArray, Cdata ] = extract_data(ANIM);
0385
0386 yset = 0;
0387 if isfield(ANIM,'Yset'),
0388 if get(ANIM.Yset,'value'),
0389 ANIM.p.minimumIntensity = get(ANIM.Ymin,'value');
0390 ANIM.p.maximumIntensity = get(ANIM.Ymax,'value');
0391 yset = 1;
0392 end
0393 end
0394 if ~yset,
0395
0396
0397
0398 Cmax = max(max(Cdata(:,start:finish)));
0399 Cmin = min(min(Cdata(:,start:finish)));
0400 absmax = max([Cmax abs(Cmin)]);
0401
0402 ANIM.p.minimumIntensity = -absmax;
0403 ANIM.p.maximumIntensity = absmax;
0404 if isfield(ANIM,'Ymin'),
0405 set(ANIM.Ymin,'string',sprintf('%7.2f',-absmax));
0406 set(ANIM.Ymin,'value',-absmax);
0407 end
0408 if isfield(ANIM,'Ymax'),
0409 set(ANIM.Ymax,'string',sprintf('%7.2f', absmax));
0410 set(ANIM.Ymax,'value', absmax);
0411 end
0412 end
0413
0414 return
0415
0416
0417 function [ H ] = toggle_visible(H),
0418
0419 toggle = get(H.Ymin,'visible');
0420 if isequal(toggle,'on'),
0421 set(H.gui,'BackingStore','off','Pointer','watch');
0422 set(H.Yset,'visible','off');
0423 set(H.Ymin,'visible','off');
0424 set(H.Ymax,'visible','off');
0425 set(H.Start,'visible','off');
0426 set(H.Finish,'visible','off');
0427 set(H.Step,'visible','off');
0428 set(H.BMovie,'visible','off');
0429 set(H.Animate,'visible','off');
0430 set(H.Save,'visible','off');
0431 set(H.Type,'visible','off');
0432 set(H.AClose,'visible','off');
0433
0434 if ishandle(H.RClose),
0435 set(H.RClose,'visible','off');
0436 set(H.View,'visible','off');
0437 set(H.Info,'visible','off');
0438 set(H.Az,'visible','off');
0439 set(H.El,'visible','off');
0440 end
0441
0442 else
0443 set(H.gui,'BackingStore','on','Pointer','arrow');
0444 set(H.Yset,'visible','on');
0445 set(H.Ymin,'visible','on');
0446 set(H.Ymax,'visible','on');
0447 set(H.Start,'visible','on');
0448 set(H.Finish,'visible','on');
0449 set(H.Step,'visible','on');
0450 set(H.Animate,'visible','on');
0451 set(H.Save,'visible','on');
0452 set(H.Type,'visible','on');
0453 set(H.BMovie,'visible','on');
0454 set(H.AClose,'visible','on');
0455
0456 if ishandle(H.RClose),
0457 set(H.RClose,'visible','on');
0458 set(H.View,'visible','on');
0459 set(H.Info,'visible','on');
0460 set(H.Az,'visible','on');
0461 set(H.El,'visible','on');
0462 end
0463
0464 end
0465
0466 return
0467
0468
0469 function [ index, point ] = NearestXYArrayPoint( data_array, point, type )
0470
0471 if ~exist('type','var') type = ''; end
0472
0473
0474
0475
0476
0477
0478 if point >= max(data_array)
0479 point = max(data_array);
0480 index = find(data_array == point);
0481 return;
0482 elseif point <= min(data_array)
0483 point = min(data_array);
0484 index = find(data_array == point);
0485 return;
0486 end
0487
0488 data_sorted = sort(data_array);
0489
0490 greater = find(data_sorted > point);
0491 greater_index = greater(1);
0492
0493 lesser = find(data_sorted < point);
0494 lesser_index = lesser(length(lesser));
0495
0496 greater_dif = data_sorted(greater_index) - point;
0497 lesser_dif = point - data_sorted(lesser_index);
0498
0499 if strcmp(type,'exact'), index = find(data_array == point);
0500 elseif strcmp(type,'nextx'), index = greater_index;
0501 elseif strcmp(type,'prevx'), index = lesser_index;
0502 else
0503 if (greater_dif < lesser_dif)
0504 index = find(data_array == data_sorted(greater_index));
0505 else
0506 index = find(data_array == data_sorted(lesser_index));
0507 end
0508 end
0509 point = data_array(index);
0510
0511 return
0512
0513
0514 function [H] = INIT(p),
0515
0516 H = get(gcbf,'userdata');
0517
0518
0519 if isfield(H,'Start'),
0520 if ~isempty(H.Start),
0521 return;
0522 end
0523 end
0524
0525 H = get(gcf,'userdata');
0526
0527
0528 if isempty(get(H.gui,'uicontextmenu')),
0529 menu = uicontextmenu;
0530 uimenu(menu,'Label','Animate','Callback','gui_topo_animate; ');
0531 set(H.gui,'uicontextmenu',menu);
0532 else
0533 menu = get(H.gui,'uicontextmenu');
0534 sibs = get(menu,'children');
0535 nomenu = 1;
0536 for i=1:length(sibs),
0537 label = get(sibs(i),'Label');
0538 if strmatch(label,'Animate'),
0539 nomenu = 0;
0540 end
0541 end
0542 if nomenu,
0543 uimenu(menu,'Label','Animate','Callback','gui_topo_animate; ');
0544 set(H.gui,'uicontextmenu',menu);
0545 end
0546 end
0547 set(H.axis,'uicontextmenu',menu);
0548 axsibs = get(H.axis,'Children');
0549 for i=1:length(axsibs),
0550 type = get(axsibs(i),'Type');
0551 if isequal(type,'patch'),
0552 if isempty(get(axsibs(i),'uicontextmenu')),
0553 set(axsibs(i),'uicontextmenu',menu);
0554 end
0555 end
0556 end
0557
0558
0559 bgcolor = get(H.gui,'Color');
0560
0561 black = find(bgcolor <= .6);
0562 fgcolor = [0 0 0];
0563 if length(black)>2, fgcolor = [1 1 1]; end
0564
0565 Font.FontName = 'Helvetica';
0566 Font.FontUnits = 'Pixels';
0567 Font.FontSize = 12;
0568 Font.FontWeight = 'normal';
0569 Font.FontAngle = 'normal';
0570
0571 if exist('p','var'), H.p = p; end
0572
0573
0574 switch H.p.mesh.data.meshtype{H.p.mesh.current},
0575 case {'scalp','elec'},
0576 samplePoint = H.p.volt.samplePoint;
0577 otherwise
0578 samplePoint = H.p.mesh.samplePoint;
0579 end
0580 H = voltage_scale(H,samplePoint,samplePoint);
0581
0582 H.msec = uicontrol('Parent',H.gui,'Style','text','Units','Normalized',Font,...
0583 'Position',[.40 .00 .2 .05],...
0584 'HorizontalAlignment','left',...
0585 'BackGroundColor',bgcolor,...
0586 'ForeGroundColor',fgcolor,...
0587 'String','msec',...
0588 'TooltipString','Time of topographic map.');
0589
0590 H.Yset = uicontrol('Parent',H.gui,'Style','checkbox','Units','Normalized',Font,...
0591 'Position',[.0 .90 .1 .05],...
0592 'HorizontalAlignment','left',...
0593 'BackGroundColor',bgcolor,...
0594 'ForeGroundColor',fgcolor,...
0595 'String','Y set',...
0596 'TooltipString','Set specific Y min/max, otherwise automatic.');
0597
0598 H.Ymin = uicontrol('Parent',H.gui,'Style','edit','Units','Normalized',Font,...
0599 'Position',[.0 .85 .10 .05],...
0600 'HorizontalAlign','right',...
0601 'Tag','YMIN',...
0602 'TooltipString','Set Y min', ...
0603 'String',sprintf('%7.1f',H.p.minimumIntensity),...
0604 'Callback',strcat('H = get(gcbf,''userdata'');',...
0605 'ymin = str2num(get(H.Ymin,''string''));',...
0606 'H.p.minimumIntensity = ymin;',...
0607 'set(H.Ymin,''string'',sprintf(''%7.2f'',ymin));',...
0608 'set(H.Ymin,''value'',ymin);',...
0609 'set(gcbf,''userdata'',H); clear H ymin;'));
0610
0611 H.Ymax = uicontrol('Parent',H.gui,'Style','edit','Units','Normalized',Font,...
0612 'Position',[.0 .80 .10 .05],...
0613 'HorizontalAlign','right',...
0614 'Tag','YMAX',...
0615 'TooltipString','Set Y max', ...
0616 'String',sprintf('%7.1f',H.p.maximumIntensity),...
0617 'Callback',strcat('H = get(gcbf,''userdata'');',...
0618 'ymax = str2num(get(H.Ymax,''string''));',...
0619 'H.p.maximumIntensity = ymax;',...
0620 'set(H.Ymax,''string'',sprintf(''%7.2f'',ymax));',...
0621 'set(H.Ymax,''value'',ymax);',...
0622 'set(gcbf,''userdata'',H); clear H ymax;'));
0623
0624
0625
0626 H.Start = uicontrol('Parent',H.gui,'Style','edit','Units','Normalized',Font,...
0627 'Position',[.0 .70 .1 .05],...
0628 'HorizontalAlignment','right',...
0629 'BackGroundColor',bgcolor,...
0630 'ForeGroundColor',fgcolor,...
0631 'String','','TooltipString','Start Time (msec)',...
0632 'Callback',strcat('H = get(gcbf,''userdata''); ',...
0633 'val = str2num(get(H.Start,''string'')); ',...
0634 'set(H.Start,''value'',val); ',...
0635 'set(H.Start,''string'',sprintf(''%7.2f'',val)); ',...
0636 'clear H val;'));
0637
0638 H.Finish = uicontrol('Parent',H.gui,'Style','edit','Units','Normalized',Font,...
0639 'Position',[.0 .65 .1 .05],...
0640 'HorizontalAlignment','right',...
0641 'BackGroundColor',bgcolor,...
0642 'ForeGroundColor',fgcolor,...
0643 'String','','TooltipString','Finish Time (msec)',...
0644 'Callback',strcat('H = get(gcbf,''userdata''); ',...
0645 'val = str2num(get(H.Finish,''string'')); ',...
0646 'set(H.Finish,''value'',val); ',...
0647 'set(H.Finish,''string'',sprintf(''%7.2f'',val)); ',...
0648 'clear H val;'));
0649
0650 H.Step = uicontrol('Parent',H.gui,'Style','edit','Units','Normalized',Font,...
0651 'Position',[.0 .60 .1 .05],...
0652 'HorizontalAlignment','right',...
0653 'BackGroundColor',bgcolor,...
0654 'ForeGroundColor',fgcolor,...
0655 'String','','TooltipString','Time Step (msec)',...
0656 'Callback',strcat('H = get(gcbf,''userdata''); ',...
0657 'val = str2num(get(H.Step,''string'')); ',...
0658 'set(H.Step,''value'',val); ',...
0659 'set(H.Step,''string'',sprintf(''%7.2f'',val)); ',...
0660 'clear H val;'));
0661
0662
0663 [ sample, timeArray, Cdata ] = extract_data(H);
0664
0665
0666 set(H.msec, 'String',sprintf('%7.2f msec',sample.time));
0667 set(H.Start, 'String',sprintf('%7.2f',sample.time));
0668 set(H.Finish,'String',sprintf('%7.2f',sample.time));
0669 set(H.Step, 'String',sprintf('%7.2f',sample.rate));
0670
0671
0672
0673
0674 H.Save = uicontrol('Parent',H.gui,'Style','checkbox','Units','Normalized',Font,...
0675 'Position',[.0 .55 .1 .05],...
0676 'HorizontalAlignment','left',...
0677 'BackGroundColor',bgcolor,...
0678 'ForeGroundColor',fgcolor,...
0679 'String','Save',...
0680 'TooltipString','Save each step to graphics file (via eeg_save_graphics).');
0681
0682 H.Type = uicontrol('Parent',H.gui,'Style','popup','Units','Normalized',Font,...
0683 'Position',[.0 .50 .1 .05],...
0684 'HorizontalAlignment','left',...
0685 'BackGroundColor',bgcolor,...
0686 'ForeGroundColor',fgcolor,...
0687 'String',{'png','jpeg','tiff','eps'},...
0688 'Value',1,...
0689 'TooltipString','Save format (warning: TIFF and EPS are large files).');
0690
0691
0692
0693 H.Animate = uicontrol('Parent',H.gui,'Style','pushbutton','Units','Normalized',Font,...
0694 'Position',[.0 .40 .1 .045],...
0695 'HorizontalAlignment','center',...
0696 'BackGroundColor',[0 .6 0],...
0697 'ForeGroundColor',[1 1 1],...
0698 'String','Animate',...
0699 'Callback','gui_topo_animate(''animate'');');
0700
0701 H.Movie = 0;
0702 H.BMovie = uicontrol('Parent',H.gui,'Style','pushbutton','Units','Normalized',Font,...
0703 'Position',[.0 .35 .1 .045],...
0704 'HorizontalAlignment','center',...
0705 'BackGroundColor',[0 .6 0],...
0706 'ForeGroundColor',[1 1 1],...
0707 'String','Movie',...
0708 'Callback',strcat('H = get(gcbf,''userdata'');',...
0709 'H.Movie = 1; ',...
0710 'set(gcbf,''userdata'',H); clear H;',...
0711 'gui_topo_animate(''animate'');'));
0712
0713 H.AClose = uicontrol('Parent',H.gui,'Style','pushbutton','Units','Normalized',Font,...
0714 'Position',[.0 .30 .1 .045],...
0715 'HorizontalAlignment','center',...
0716 'BackGroundColor',[.6 0 0],...
0717 'ForeGroundColor',[1 1 1],...
0718 'String','Close','Value',0,...
0719 'TooltipString','Use right click context menu after ''Close'' to get animation back.',...
0720 'Callback',strcat('H = get(gcbf,''userdata'');',...
0721 'delete(H.Yset); delete(H.Ymin); delete(H.Ymax); ',...
0722 'delete(H.msec); delete(H.Start); delete(H.Finish); delete(H.Step); ',...
0723 'delete(H.Animate); delete(H.Save); delete(H.Type); ',...
0724 'delete(H.BMovie); delete(H.AClose); ',...
0725 'fields = fieldnames(H); ',...
0726 'trashfields(1) = strmatch(''msec'', fields,''exact''); ',...
0727 'trashfields(1) = strmatch(''Start'', fields,''exact''); ',...
0728 'trashfields(2) = strmatch(''Finish'',fields,''exact''); ',...
0729 'trashfields(3) = strmatch(''Step'', fields,''exact''); ',...
0730 'trashfields(4) = strmatch(''Animate'', fields,''exact''); ',...
0731 'trashfields(5) = strmatch(''Save'', fields,''exact''); ',...
0732 'trashfields(6) = strmatch(''Type'', fields,''exact''); ',...
0733 'trashfields(7) = strmatch(''AClose'',fields,''exact''); ',...
0734 'trashfields(8) = strmatch(''Ymin'', fields,''exact''); ',...
0735 'trashfields(9) = strmatch(''Ymax'', fields,''exact''); ',...
0736 'trashfields(10) = strmatch(''Yset'', fields,''exact''); ',...
0737 'trashfields(11) = strmatch(''BMovie'',fields,''exact''); ',...
0738 'for i=1:12, ',...
0739 ' H = setfield(H,char(fields(trashfields(i))),[]); ',...
0740 'end; ',...
0741 'set(H.gui,''userdata'',H); clear H trashfields fields; '));
0742
0743
0744 set(H.gui,'userdata',H);
0745
0746 return