[Dart-dev] [9594] DART/trunk/diagnostics/matlab/two_experiments_overview.m: Added baggage to support multiple versions of matlab.
nancy at ucar.edu
nancy at ucar.edu
Mon Jan 25 11:03:49 MST 2016
Revision: 9594
Author: thoar
Date: 2016-01-25 11:03:48 -0700 (Mon, 25 Jan 2016)
Log Message:
-----------
Added baggage to support multiple versions of matlab.
Mathworks keeps renaming their &$@ instrinsics.
Modified Paths:
--------------
DART/trunk/diagnostics/matlab/two_experiments_overview.m
-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/two_experiments_overview.m
===================================================================
--- DART/trunk/diagnostics/matlab/two_experiments_overview.m 2016-01-25 17:13:57 UTC (rev 9593)
+++ DART/trunk/diagnostics/matlab/two_experiments_overview.m 2016-01-25 18:03:48 UTC (rev 9594)
@@ -29,6 +29,12 @@
%
% DART $Id$
+matver = ver('Matlab');
+
+if str2double(matver.Version) < 8.3
+ error('Need at least Matlab 2014a for this function.')
+end
+
%% handle the user input - somehow.
p = inputParser;
@@ -40,10 +46,19 @@
defaultFlagLevel = 0.00; % ten percent would be 0.10
defaultVarCheck = -1;
-addParameter(p, 'FlagLevel', defaultFlagLevel, @isnumeric);
-addParameter(p, 'FileOne', defaultFileOne, @ischar);
-addParameter(p, 'FileTwo', defaultFileTwo, @ischar);
-addParameter(p, 'VarCheck', defaultVarCheck, @isnumeric);
+% Thanks Mathworks, for making another unwarranted change.
+existisstupid = which('addParameter');
+if (isempty(existisstupid))
+ addParamValue(p, 'FlagLevel', defaultFlagLevel, @isnumeric);
+ addParamValue(p, 'FileOne', defaultFileOne, @ischar);
+ addParamValue(p, 'FileTwo', defaultFileTwo, @ischar);
+ addParamValue(p, 'VarCheck', defaultVarCheck, @isnumeric);
+else
+ addParameter(p, 'FlagLevel', defaultFlagLevel, @isnumeric);
+ addParameter(p, 'FileOne', defaultFileOne, @ischar);
+ addParameter(p, 'FileTwo', defaultFileTwo, @ischar);
+ addParameter(p, 'VarCheck', defaultVarCheck, @isnumeric);
+end
p.parse(varargin{:}) % parse inputs
@@ -75,7 +90,7 @@
close all
files = {OldFile, NewFile};
titles = {'old','new'};
- obsnames = {verticalobs{VarCheck}};
+ obsnames{1} = verticalobs{VarCheck};
copy = 'bias';
prpo = 'forecast';
% fires up N figure windows ... for each region
@@ -260,7 +275,7 @@
% xticklabel = {'North','Tropics','South'};
xticklabel = cell(1,length(regions));
for i=1:length(regions)
- bob = strsplit(regions{i});
+ bob = mysplit(regions{i});
xticklabel{i} = bob{1};
end
@@ -276,7 +291,8 @@
h = title({varname, titlestring});
set(h,'interpreter','none');
h = colorbar;
-set(h.Label,'String','positive means new is better');
+xh = get(h,'YLabel');
+set(xh,'String','positive means new is better');
% plot a symbol at each of the weak region/levels
@@ -396,6 +412,22 @@
end
+
+%%----------------------------------------------------------------------
+
+
+function firstword = mysplit(inputstring)
+% Because Mathworks refuses to leave well enough alone ...
+
+existisstupid = which('strsplit');
+if (isempty(existisstupid))
+ firstword = {strtok(inputstring)};
+else
+ firstword = strsplit(inputstring);
+end
+
+end
+
% <next few lines under version control, do not edit>
% $URL$
% $Revision$
More information about the Dart-dev
mailing list