summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/fixvariable.m
blob: 2213431e71cca3c3b99a44887befae115944ca64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% Code that clears an empty variable, or a NaN vsriable.
% Does not clear structures, or cells.

if exist('var2fix'),
   if   eval(['exist(''' var2fix ''') == 1']),
      if eval(['isempty(' var2fix ')']),
	 eval(['clear ' var2fix ]);
      else
	 if eval(['~isstruct(' var2fix ')']),
	    if eval(['~iscell(' var2fix ')']),
	       if eval(['isnan(' var2fix '(1))']),
		  eval(['clear ' var2fix ]);
	       end; 
	    end;
	 end;
      end;
   end;
end;