Newer
Older
function varargout=mi(varargin)
%MI Histogram based mutual information.
% I=MI(X) computes the auto mutual information using 10 bins,
% where X can be a multi-column vector.
%
% I=MI(X1,X2,...,Xn) computes the pair-wise mutual information
% between all pairs of X1,X2,...,Xn using 10 bins. The result I
% is a N x N matrix.
%
% I=MI(X1,X2,...,Xn,N), where N is a scalar, determines the number
% of bins N.
%
% I=MI(X1,X2,...,Xn,L) or I=MI(X1,X2,...,Xn,N,L), where L is a
% scalar, computes mutual informations for shifting of the
% components of each pair of X1,X2,...,Xn until a maximal lag L.
%
% [I S]=MI(...) computes the mutual information and the
% standard error (only for one- and two-dimensional data).
%
% MI(...) without any output arguments opens a GUI for interactively
%
% By using the GUI, the mutual information can be stored into the
% workspace. If their standard error is available, they will be
% appended to the mutual information matrix as the last two columns.
%
% MI(...,param) additional parameters according to the GUI are
% available:
% gui - Creates the GUI.
% nogui - Suppresses the GUI.
% silent - Suppresses all output.
%
% MI without any arguments calls a demo (the same as the example
% below).
%
% mi(x,40,100)
%
% See also HIST2, HISTN, ENTROPY.
%
% References:
% Roulston, M. S.:
% Estimating the errors on measured entropy and mutual
% information, Physica D, 125, 1999.
% Andre Sitz/ Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
% $Date$
% $Revision$
%
% $Log$
% Revision 3.9 2006/02/14 11:46:15 marwan
% *** empty log message ***
%
% Revision 3.8 2005/03/16 11:19:02 marwan
% help text modified
%
% Revision 3.7 2004/11/10 07:05:09 marwan
% initial import
%
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
%
% This program is part of the new generation XXII series.
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or any later version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% programme properties
global props
init_properties
action='';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check the input
error(nargchk(0,99,nargin));
if nargout>2, error('Too many output arguments'), end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% splash the GPL
splash_gpl('mi');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% error control
try
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% read the input
set(0,'ShowHidden','on')
delete(findobj('Tag','msgbox'))
nogui=0;
lag=[];
nbin=10;
x={}; sum_m=0; sm_length=[];
if nargin & isnumeric(varargin{1})
for i=1:nargin
if isnumeric(varargin{i}) & max(size(varargin{i}))>1
y=varargin{i};
if size(y,1)==1, y=y'; end
my=size(y,2); sum_m=sum_m+my;
mx=size(y,1);
if isempty(sm_length), sm_length=mx; end
if mx < sm_length, sm_length=mx; end
x(i)={y};
end
end
m=size(x,2); if sum_m==1; lag=0; x(2)=x(1); sum_m=2; m=2; end
if isempty(x), error('Not a valid input vector.'), end
i_double=find(cellfun('isclass',varargin,'double'));
i_char=find(cellfun('isclass',varargin,'char'));
if length(i_double)>1
if max(size(varargin{i_double(end-1)}))==1
nbin=varargin{i_double(end-1)};
end
end
if max(size(varargin{i_double(end)}))==1
lag=varargin{i_double(end)}; else if isempty(lag), lag=0; end
end
action='init';
if ~isempty(i_char)
if findstr(lower(varargin{i_char(1)}(1)),'n')
if findstr(lower(varargin{i_char(1)}(1)),'s')
if findstr(lower(varargin{i_char(1)}(1)),'g')
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
nogui=1;
action='compute';
end
if nogui==-1; nogui=0; end
elseif nargin & ischar(varargin{1}) & ~isempty(varargin{1})
if isempty(findobj('Tag','MI_Fig')) & isempty(findobj('Tag','MI_Fig'))
% h=errordlg('Start the programme with mi(vector,vector).');
% set(h,'Tag','msgbox')
action='end';
else
action=varargin{1};
h=findobj('Tag','MI_Fig');
x=get(h(1),'UserData');
h=findobj('Tag','nBin');
nbin=str2num(get(h(1),'String'));
m=size(x,2);
h=findobj('Tag','maxLag');
lag=str2num(get(h(1),'String'));
end
else
action='init';
end
if ~nargin
x={sin(0:.2:8*pi)'+.1*randn(126,1)}; x(2)=x; m=2; sum_m=2;
nbin=10;
lag=40;
nogui=0;
else
if ischar(varargin{1})
action=varargin{1};
end
end
switch(action)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% create gui
case 'init'
h8=figure(props.window,... % Plot Figure
'Tag','MI_Fig',...
'MenuBar','Figure',...
'Position',[69.5000 39.6429 120.0000 30.0714],...
'PaperType','a4',...
'PaperPosition',[0.25 0.25 7.7677 11.193],...
'PaperOrientation','portrait',...
'UserData',x,...
'Name','Mutual Information');
set(0,'showhidden','on')
h=findobj('Label','&Help','Type','uimenu');
if isempty(h)
h=uimenu('Label','&Help');
h2=uimenu('Parent',h(1),'Label','&Help Mutual Information','Callback','helpwin mi');
else
h1=flipud(get(h(1),'Children'));
set(h1(1),'Separator','on')
h2=uimenu('Parent',h(1),'Label','&Help Mutual Information','Callback','helpwin mi');
copyobj(h1,h(1))
delete(h1)
end
h=axes(props.axes,...
'Position',[89 24.8 6.8 3.5]);
logo=load('logo');
h2=imagesc([logo.logo fliplr(logo.logo)]);
set(h2,'Tag','uniLogo')
set(h,props.logo,'Tag','axes_logo')
h=uicontrol(props.text,...
'Tag','text_logo',...
'String','Uni Potsdam',...
'Position',[97 24.2143 22 3.5714]);
h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','2002-2006'});
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
set(h,'String',h2)
h=axes(props.axes,...
'Tag','mi_axes',...
'Box','On',...
'Position',[9 3.5 72.8333 23.0714]);
h=uicontrol(props.frame,...
'Tag','frame',...
'Position',[91.5000 1.3571 23.5000 20.7857]);
h=uicontrol(props.text,...
'Tag','text',...
'String','Number of bins',...
'Position',[93.8333 20 17.8333 1.5000]);
h=uicontrol(props.edit,...
'Tag','nBin',...
'String',num2str(nbin),...
'ToolTip','Number of bins for estimation of the probability function.',...
'Position',[93.8333 18.5714 17.8333 1.5000]);
h=uicontrol(props.text,...
'Tag','text',...
'String','max. Lag',...
'Position',[93.8333 16.5 17.8333 1.5000]);
h=uicontrol(props.edit,...
'Tag','maxLag',...
'String',num2str(lag),...
'ToolTip','Maximal lag.',...
'Position',[93.8333 15.0714 17.8333 1.5000]);
h=uicontrol(props.text,...
'Tag','text_show',...
'String','Show components',...
'Enable','off',...
'Position',[93.8333 12.5 21.8333 1.5000]);
h=uicontrol(props.popup,...
'Tag','edit_show1',...
'String','1|2',...
'Enable','off',...
'Callback','mi plot_mi',...
'Position',[93.8333 11.0714 7 1.5000]);
h=uicontrol(props.text,...
'Tag','text_show',...
'String','vs.',...
'Enable','off',...
'HorizontalAlign','center',...
'Position',[101.24995 11.0714-.2 4 1.5000]);
h=uicontrol(props.popup,...
'Tag','edit_show2',...
'String','1|2',...
'Callback','mi plot_mi',...
'Enable','off',...
'Position',[105.6666 11.0714 7 1.5000]);
h=uicontrol(props.button,...
'String','Store',...
'Tag','button_store',...
'Enable','Off',...
'ToolTip','Stores the mutual information into a variable in the workspace.',...
'Callback','mi store',...
'Position',[103.8666 8.2143 8.8 2.2143]);
h=uicontrol(props.button,...
'Tag','button_print',...
'CallBack','mi print',...
'ToolTip','Prints the MI window.',...
'String','Print',...
'Position',[93.8333 8.2143 8.8 2.2143]);
h=uicontrol(props.button,...
'Tag','button_close',...
'CallBack','mi close',...
'ToolTip','Closes the MI window.',...
'String','Close',...
'Position',[93.8333 2.6429 18.8333 2.2143]);
h=uicontrol(props.button,...
'String','Apply',...
'Tag','button_apply',...
'ToolTip','Starts the computation.',...
'Callback','mi compute',...
'Position',[93.8333 5.4286 18.8333 2.2143]);
set(h8, 'HandleVis','CallBack')
tags={'MI_Fig';'axes_logo';'text_logo';'frame';'text';'mi_axes';'nBin';'maxLag';'text_show';'edit_show1';'edit_show2';'button_store';'button_print';'button_close';'button_apply';};
h=[];
for i=1:length(tags); h=[h; findobj('Tag',tags{i})]; end
set(h,'Units','Norm')
mi('compute')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% close windows
case 'close'
set(0,props.root)
h=findobj('Tag','MI_Fig');
if ~isempty(h), close(h(1)), end
clear all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% store
case 'store'
if ~isempty(findobj('Tag','button_store'))
h=findobj('Tag','button_store');
h1=findobj('Tag','button_close');
if ~isempty(h1), vname_old=get(h1(1),'UserData'); else vname_old=''; end
if isempty(vname_old), vname_old=''; end
vname=char(inputdlg('Choose a variable name.','Store output',1,{vname_old}));
if isempty(vname)
return
else
MI=get(h(1),'UserData');
assignin('base',vname, [MI{1:end}])
h=helpdlg(['Mutual information has been assigned to the workspace variable ''',vname,'''.',10,...
'If available, the standard errors are given in the second column.'],'Store output');
set(h,'Tag','msgbox')
set(h1(1),'UserData',vname)
end
end
set(0,props.root)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% print
case 'print'
h=findobj('Tag','uniLogo');
h_axes=findobj('Tag','mi_axes','Parent',gcf); h_axes=h_axes(1);
h=[h; findobj('Tag','text','Parent',gcf)];
h=[h; findobj('Tag','text_logo','Parent',gcf)];
h=[h; findobj('Tag','frame','Parent',gcf)];
h=[h; findobj('Tag','nBin','Parent',gcf)];
h=[h; findobj('Tag','maxLag','Parent',gcf)];
h=[h; findobj('Tag','text_show','Parent',gcf)];
h=[h; findobj('Tag','edit_show1','Parent',gcf)];
h=[h; findobj('Tag','edit_show2','Parent',gcf)];
h=[h; findobj('Tag','button_store','Parent',gcf)];
h=[h; findobj('Tag','button_print','Parent',gcf)];
h=[h; findobj('Tag','button_close','Parent',gcf)];
h=[h; findobj('Tag','button_apply','Parent',gcf)];
set(h,'Visible','Off')
set(h_axes,'Units','Character')
old_pos=get(h_axes,'Position');
set(h_axes,'Units','normalize','Position',[0.1300 0.1100 0.7750 0.8150])
h_dlg=printdlg;
waitfor(h_dlg)
set(h_axes,'Units','Character','Position',old_pos)
set(h_axes,'Units','normalize')
set(h,'Visible','On')
set(0,props.root)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% computation
case 'compute'
warning off
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
if ~nogui
h_fig=findobj('tag','MI_Fig');
setptr(gcf,'watch'),
obj=({'maxLag','nBin','button_store','button_print','button_close','text','text_show','edit_show1','edit_show2'});
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','Off')
end
end
h=findobj('tag','button_apply');
set(h(1),'ToolTip','Stops the computation.','String','Stop','Callback','set(0,''ShowHidden'',''on'');h=findobj(''tag'',''button_apply'');set(h(1),''String'',''Stopped'');set(0,''ShowHidden'',''off'')')
end
if nogui~=2; hw=waitbar(0,'Estimation progress'); end
for t=0:lag,
if ~nogui
set(0,'ShowHidden','on')
h=findobj('tag','button_apply','Parent',h_fig(1));
if strcmpi(get(h(1),'string'),'stopped')
MI((t:lag)+1,1)=NaN;
MI_sigma((t:lag)+1,1)=NaN;
break
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% compute the distributions
for k=1:m; for l=1:m;
P2=histn(x{k},x{l},nbin,t,'silent'); % 2D distribution
mP=length(size(P2));
if sum(~P2(:))/prod(size(P2)) > 0.99
warning on
warning('Too less data points for the estimation of the joint distribution.');
MI(k,l,(t:lag)+1)=NaN;
MI_sigma(k,l,(t:lag)+1)=NaN;
if ~nogui,
h=findobj('tag','button_apply');
set(h(1),'ToolTip','Starts the computation.','String','Apply','Callback','mi compute')
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','On')
end
end
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
end
warning on
if nogui~=2, delete(hw); end
return
end
P2=P2/sum(P2(:)); % normalization
clear P1x
if mP==2
P1x=sum(P2')'; % distribution for x
P1y=sum(P2); % distribution for y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% compute the mutual information
I1=[-sum((P1x(P1x~=0)).*log(P1x(P1x~=0))), -sum((P1y(P1y~=0)).*log(P1y(P1y~=0)))]; % entropies of Px and Py
I2=-sum(P2(P2~=0).*log(P2(P2~=0))); % entropy of joint distribution Pxy
I2_syserr=(length(P1x(P1x~=0))+length(P1y(P1y~=0))-length(P2(P2~=0).*log(P2(P2~=0)))-1)/(2*length(x{k})); % standard error for estimation of entropy
MI(k,l,t+1)=I1(1)+I1(2)-I2+I2_syserr;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% compute the standard errors
P2xy=P1x*P1y;
i=(P2xy~=0 & P2~=0);
MI_sigma(k,l,t+1)=sqrt( sum( (log(P2xy(i)./P2(i))+MI(t+1)).^2 .*(P2(i).*(1-P2(i)))) /length(x{k}));
else
I1=[];
for i=1:mP;
P21=permute(P2,[i,i+1:mP, 1:(i-1)]);
P1x(:,i)=sum(reshape(P21,size(P21,2),size(P21,2)^(mP-1))')'; % distribution for x_i
I1 = -sum((P1x(P1x~=0)).*log(P1x(P1x~=0))); % sum of entropies of Px_i
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% compute the mutual information
I2=-sum(P2(P2~=0).*log(P2(P2~=0))); % entropy of joint distribution Pxy
I2_syserr=(length(P1x(P1x~=0))-length(P2(P2~=0).*log(P2(P2~=0)))-1)/(2*length(x{k})); % standard error for estimation of entropy
MI(k,l,t+1)=I1-I2+I2_syserr;
end
end, end
if nogui~=2; waitbar(t/lag); end
if ~nogui & t*10/lag == ceil(t*10/lag)
h=findobj('Tag','button_store');
if m==2
out_str{1}=MI; out_str{2}=MI_sigma;
else
out_str{1}=MI;
end
set(h(1),'UserData',out_str)
mi('plot_mi')
end
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
h=findobj('tag','button_apply');
set(h(1),'ToolTip','Starts the computation.','String','Apply','Callback','mi compute')
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','On')
end
end
end
if ~isempty(findobj('Tag','MI_Fig'))
h=findobj('Tag','button_store');
if m==2
out_str{1}=MI; out_str{2}=MI_sigma;
else
out_str{1}=MI;
end
set(h(1),'Enable','On',...
'UserData',out_str)
end
if nargout==1
varargout(1)={MI};
elseif nargout==2
varargout(1)={MI};
varargout(2)={MI_sigma};
end
if ~nogui, setptr(h_fig(1),'arrow'), end
warning on
if isnan(MI(1,1)), warning('Mutual information is NaN. Use smaller bin size.'), end
try, set(0,props.root), end
if nargout==0
mi('plot_mi')
end
if nargout==0 & nogui
assignin('base','ans', MI)
ans=MI
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% output
case 'plot_mi'
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
h_fig = findobj('Tag','MI_Fig');
if ~isempty(h_fig)
h=findobj('Tag','button_store','Parent',h_fig(1));
if isempty(h), return, end
x=get(h(1),'UserData');
MI=x{1}; if m==2; MI_sigma=x{2}; end
set(0,'current',h_fig(1))
h_axes=findobj('Tag','mi_axes','Parent',h_fig(1)); h_axes=h_axes(1);
h_res=findobj('Tag','mi_result','Parent',h_fig(1)); delete(h_res);
h_show=[findobj('Tag','text_show','Parent',h_fig(1));...
findobj('Tag','edit_show1','Parent',h_fig(1));...
findobj('Tag','edit_show2','Parent',h_fig(1))];
if lag==0
set(h_axes,'Visible','off'),cla
set(h_show,'enable','off')
if m==2;
for k=1:length(MI)
out_str(k)={sprintf(repmat('%8.3f %6.3f ',1,2*length(MI)),reshape([MI(k,:);MI_sigma(k,:)],1,2*length(MI)))};
end
else
for k=1:length(MI)
out_str(k)={sprintf(repmat('%8.3f ',1,length(MI)),MI(k,:))};
end
end
h=uicontrol(props.text,...
'Tag','mi_result',...
'HorizontalAlignment', 'left',...
'FontWeight', 'bold',...
'String',['Mutual Information: ']);
ex=get(h,'Extent'); set(h,'Position',[11 21 ex(3:4)]);
h=uicontrol(props.listbox,...
'Tag','mi_result',...
'Position',[9 7 72.8333 3.0714],...
'HorizontalAlignment', 'left',...
'String',out_str);
ex1=get(h,'Extent'); if ex1(3)>75, ex1(3)=75; end
if m<=10
set(h,'Position',[11 21-m*ex(4) ex1(3) ex1(4)*m]);
else
set(h,'Position',[11 21-10*ex(4) ex1(3) ex1(4)*10]);
end
else
set(h_axes,'Visible','on'); tx=sprintf('%i|',1:m);
set(h_show(end-1:end),'String',tx(1:end-1))
plot(0)
dimx=get(h_show(end-1),'Value');
dimy=get(h_show(end),'Value');
if m==2;
s1=[permute(MI(dimx,dimy,:),[3,1,2])+3*permute(MI_sigma(dimx,dimy,:),[3,1,2]); flipud(permute(MI(dimx,dimy,:),[3,1,2])-3*permute(MI_sigma(dimx,dimy,:),[3,1,2]))]';
s3=[0:size(MI,3)-1, size(MI,3)-1:-1:0];
if all(size(s3) == size(s1))
patch(s3,s1,-10,'FaceColor',[.9 .9 1],'EdgeColor',[.85 .85 1])
end
hold on
end
plot(0:size(MI,3)-1,permute(MI(dimx,dimy,:),[3,1,2])), grid on
xlabel('Lag'), ylabel('Mutual Information')
hold off
set(gca,'Tag','mi_axes','layer','top','xlim',[0 lag])
end
drawnow
try, set(0,props.root), end
end
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the end
case 'end'
end
set(0,'ShowHidden','off')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% error handling
%if 0
catch
if ~isempty(findobj('Tag','TMWWaitbar')), delete(findobj('Tag','TMWWaitbar')), end
cmd={['mean'];['var'];['std'];['median'];['squmean'];['geomean'];['bias'];['skewness'];['kurtosis']};
z_whos=whos;x_lasterr=lasterr;y_lastwarn=lastwarn;if nargin;in=varargin{1};else in.class='no input given';end
if ischar(in), in2=in; else, in2=[]; end
in=whos('in');
if ~strcmpi(lasterr,'Interrupt')
fid=fopen('error.log','w');
err=fprintf(fid,'%s\n','Please send us the following error report. Provide a brief');
err=fprintf(fid,'%s\n','description of what you were doing when this problem occurred.');
err=fprintf(fid,'%s\n','E-mail or FAX this information to us at:');
err=fprintf(fid,'%s\n',' E-mail: marwan@agnld.uni-potsdam.de');
err=fprintf(fid,'%s\n',' Fax: ++49 +331 977 1142');
err=fprintf(fid,'%s\n\n\n','Thank you for your assistance.');
err=fprintf(fid,'%s\n',repmat('-',50,1));
err=fprintf(fid,'%s\n',datestr(now,0));
err=fprintf(fid,'%s\n',['Matlab ',char(version),' on ',computer]);
err=fprintf(fid,'%s\n',repmat('-',50,1));
err=fprintf(fid,'%s\n',x_lasterr);
err=fprintf(fid,'%s\n',y_lastwarn);
err=fprintf(fid,'%s\n',[' during ==> mi:',action]);
err=fprintf(fid,'%s',[' input ==> ',in.class]);
if ~isempty(in2), err=fprintf(fid,'\t%s\n',[' (',in2,')']); end
err=fprintf(fid,'%s\n',[' errorcode ==> no errorcode available']);
err=fprintf(fid,'%s\n',' workspace dump ==>');
if ~isempty(z_whos),
err=fprintf(fid,'%s\n',['Name',char(9),'Size',char(9),'Bytes',char(9),'Class']);
for j=1:length(z_whos);
err=fprintf(fid,'%s',[z_whos(j).name,char(9),num2str(z_whos(j).size),char(9),num2str(z_whos(j).bytes),char(9),z_whos(j).class]);
if ~strcmp(z_whos(j).class,'cell') & ~strcmp(z_whos(j).class,'struct')
content=eval(z_whos(j).name);
content=mat2str(content(1:min([size(content,1),500]),1:min([size(content,2),500])));
err=fprintf(fid,'\t%s',content(1:min([length(content),500])));
elseif strcmp(z_whos(j).class,'cell')
content=eval(z_whos(j).name);
err=fprintf(fid,'\t');
for j2=1:min([length(content),500])
content2=content{j2};
err=fprintf(fid,'{%s} ',content{j2});
end
elseif strcmp(z_whos(j).class,'struct')
content=fieldnames(eval(z_whos(j).name));
content=char(content); content(:,end+1)=' '; content=content';
err=fprintf(fid,'\t%s',content(:)');
end
err=fprintf(fid,'\n');
end, end
err=fclose(fid);
disp('----------------------------');
disp(' ERROR OCCURED');
disp(' during executing mi');
disp('----------------------------');
disp(x_lasterr);
disp([' during ',action]);
disp('----------------------------');
disp(' Please send us the error report. For your convenience, ')
disp(' this information has been recorded in: ')
disp([' ',fullfile(pwd,'error.log')]), disp(' ')
disp(' Provide a brief description of what you were doing when ')
disp(' this problem occurred.'), disp(' ')
disp(' E-mail or FAX this information to us at:')
disp(' E-mail: marwan@agnld.uni-potsdam.de')
disp(' Fax: ++49 +331 977 1142'), disp(' ')
disp(' Thank you for your assistance.')
warning('on')
end
try,if ~nogui
setptr(h_fig(1),'arrow')
h=findobj('tag','button_apply');
set(h(1),'ToolTip','Starts the computation.','String','Apply','Callback','mi compute')
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','On')
end
end
end,end
if nargout, varargout={NaN}; end
try, set(0,props.root), end
set(0,'ShowHidden','off')
end