BlandAltmanPlot

Formatted documentation for the BlandAltmanPlot function.

Create a Bland-Altman plot and return a struct with results and handles.

Contents

Description

This function does not require any toolbox, except on Matlab 6.5. The method for calculating characteristic values and the example data were taken from Bland&Altman (Lancet, 1986, i:307-310) DOI:10.1016/S0140-6736(86)90837-8

The implementation of tinv and alpha_to_Z are by Star Strider. These implementations mean you can use this function without the Statistics Toolbox except on Matlab 6.5.

Syntax

BlandAltmanPlot(var1,var2)
BlandAltmanPlot(___,Name,Value)
BlandAltmanPlot(___,optionstruct)
h=BlandAltmanPlot(___)
Note: running without inputs runs an example.

Output arguments

Field name Contents
h. .input .alpha alpha value used for plots and calculations
.var1 first variable used for plot
.var1 second variable used for plot
.data .mu mean value of var2-var1
.loa lower and upper limits of agreement
.CI .mu lower and upper bound of the CI of the mean
.loa_lower lower and upper bound of the CI of the lower LoA
.loa_upper lower and upper bound of the CI of the upper LoA
.xxyy axis extents used
.plot .data handle to the data plot object
.mean handle to the mean line
.loa_lo handle to the lower LoA line
.loa_hi handle to the upper LoA line
.CI_lo handle to the lower LoA errorbar
.CI_mu handle to the mean errorbar
.CI_hi handle to the upper LoA errorbar
.text .mean handle to the 'mean: %f' text object
.meanCI handle to the 'CI: %f-%f' text object
.loa_hi handle to the 'LoA: %f' text object
.loa_hi_CI handle to the 'CI: %f-%f' text object
.loa_lo handle to the 'LoA: %f' text object
.loa_lo_CI handle to the 'CI: %f-%f' text object

Input arguments

var1,var2 Create a Bland-Altman plot with the two entered variables. Both must be numeric vectors with 2%nbsp;dimensions or fewer (so 1x1x30 sized arrays will return an error). The y-values are var2-var1, the x-values are (var1+var2)/2, unless the plot_x_mean switch is set to false, in which case var1 determines the x-values.
Name,Value The settings below can be entered with a Name,Value syntax.
options Instead of the Name,Value, parameters can also be entered in a struct. Missing fields will be set to the default values.

Name,Value pairs

AddDetailsText Add the details to the plot as text. This will add the mean and limits of agreement above the plotted lines. The confidence intervals will be added under the plotted lines if enabled by the plotCI parameter. The text elements are placed on the far right side of the plot.
default=true;
alpha The alpha value is used for the limits of agreement, as well as for the confidence intervals.
default=0.05;
plotCI Add the CIs of the mean and LoAs to the plot with the errorbar function. If AddDetailsText is set to true, this parameter controls both the whiskers and the text. The whiskers are plotted close to the left side of the plot.
default=true;
GroupIndex You can split the plot into an array of line objects so you can adjust properties like Color and Marker for subgroups. Setting this to an empty array will keep all points in a single group.
This parameter must contain only positive integer values, as it is used to index h.plot.data.
default=[];
plot_x_mean If set to false, the first input is used for the x-coordinate, instead of using the mean.
default=true;
StoreToAppdata If set to true, the output of this function will be stored in the axes object with setappdata, so it can be easily retrieved. The output struct is set to the data field named HJW___BlandAltmanPlot___data.
default=true;
Parent/TargetAxes This determines the parent axes for the plots and texts. If left empty, gca is used to determine the target axes. If TargetAxes and Parent both are non-empty, TargetAxes is ignored.
default=[];
TextDigitsDisplayed This is either the number of digits used in the text elements, or a FormatSpec that makes num2str return a non-empty char.
default=4;
xxyy This parameter controls the axis range. It has to be a 4-element vector. Any NaN values will be auto-determined based on the input data (taking into account the value of plot_x_mean). An empty input is equivalent to [NaN NaN NaN NaN].
default=[];

Example: Run analysis from original paper

Run the example from the original paper by Bland&Altman.

%(use only the first measurement of each peak flow meter)
var1=[494,395,516,434,476,557,413,442,650,433,417,656,267,478,178,423,427];
var2=[512,430,520,428,500,600,364,380,658,445,432,626,260,477,259,350,451];
meaningless_grouping=1+mod(var1,3);
h=BlandAltmanPlot(var1,var2,'GroupIndex',meaningless_grouping);

% Change the appearance of all markers:
set(h.plot.data,'Marker','*')
% Change the appearance of the markers for a subgroup:
set(h.plot.data(1),'Color','r','Marker','o')
% Change a property of the axes:
ax=get(h.plot.data(1),'Parent');
set(ax,'YTick',-100:50:100)

Compatibility, version info, and licence

Compatibility considerations:

Test suite result Windows XP/7/10 Ubuntu 20.04 LTS MacOS 10.15 Catalina
Matlab R2021a W10 : Pass
Matlab R2020b W10 : Pass
Matlab R2020a W10 : Pass
Matlab R2018a W10 : Pass Pass
Matlab R2015a W10 : Pass Pass
Matlab R2013b W10 : Pass
Matlab R2012b W10 : Pass
Matlab R2011a W10 : Pass Pass
Matlab R2010b Pass
Matlab R2010a W7 : Pass
Matlab R2007b W10 : Pass
Matlab 7.1 (R14SP3) XP : Pass
Matlab 6.5 (R13) W10 : Pass
Octave 6.2.0 W10 : Pass
Octave 5.2.0 W10 : Pass Pass
Octave 4.4.1 W10 : Pass Pass

Version: 1.2.0
Date:    2021-04-29
Author:  H.J. Wisselink
Licence: CC by-nc-sa 4.0 ( https://creativecommons.org/licenses/by-nc-sa/4.0 )
Email = 'h_j_wisselink*alumnus_utwente_nl';
Real_email = regexprep(Email,{'*','_'},{'@','.'})

Test suite

This tester is included so you can test if your own modifications would introduce any bugs. These tests form the basis for the compatibility table above.

To save space, the tester function below was minified. The full tester function (including all comments) can be found here.

% Tester function for BlandAltmanPlot. This runs the example to see if the basics work.
%
% Pass:    passes all tests
% Partial: [no partial passing condition]
% Fail:    fails any test
%
function v000=aaa___BlandAltmanPlot___test(varargin),v000='pass';try v001=struct('message',...
'hash comparison failed');v002=figure('Visible','off');drawnow;v003=BlandAltmanPlot;close(v002);
v003=rmfield(v003,{'plot','text'});v003=round_fieds(v003,10);catch v001;if isempty(v001),v001=...
lasterror;end,try close(v002);catch,end,v003=struct;end,v004=ComputeNonCryptHash(v003,128,...
'-v2');if ~strcmp(v004,'5E7A182FF8907C9EE2FD138F491F662C'),if nargout==1,v000='fail';return,...
else,error(v001.message),end,end,disp('test finished successfully'),if nargout==0,clear,end,end
function [v000,v001,v002,v003]=parse_warning_error_redirect_inputs(varargin),if nargin==1,if ...
isa(varargin{1},'struct') || isa(varargin{1},'MException'),v004=varargin{1};try v002=v004.stack;
v003=get_trace(0,v002);catch,[v003,v002]=get_trace(3);end,v000=v004.identifier;v001=...
v004.message;v005=...
'Error using <a href="matlab:matlab.internal.language.introspective.errorDocCallback(';if ...
isa(v004,'struct') && numel(v001)>numel(v005) && strcmp(v005,v001(1:numel(v005))),...
v001(1:find(v001==10,1))='';end,else,[v003,v002]=get_trace(3);[v000,v001]=deal('',varargin{1});
end,else,[v003,v002]=get_trace(3);if ~isempty(strfind(varargin{1},'%')),v000='';v006=...
varargin(2:end);v001=sprintf(varargin{1},v006{:});else,v000=varargin{1};v001=varargin{2};if ...
nargin>3,v006=varargin(3:end);v001=sprintf(v001,v006{:});end,end,end,end
function v000=round_fieds(v000,v001),v002=10^v001;v003=fieldnames(v000);for v004=1:numel(v003),...
v005=v000.(v003{v004});if isa(v005,'struct'),v005=round_fieds(v005,v001);else,v005=...
round(v005*v002)/v002;end,v000.(v003{v004})=v005;end,end
function v000=t_inv_reimplementation___tdist2T(v001,v002),v000=1-betainc(v002/(v002+v001^2), ...
v002/2, 0.5);end
function v000=parse_warning_error_redirect_options(v000),if ~isfield(v000,'boolean'),...
v000.boolean=struct;end,if ~isfield(v000.boolean,'con') || isempty(v000.boolean.con),...
v000.boolean.con=false;end,if ~isfield(v000.boolean,'fid') || isempty(v000.boolean.fid),...
v000.boolean.fid=isfield(v000,'fid');end,if ~isfield(v000.boolean,'obj') || ...
isempty(v000.boolean.obj),v000.boolean.obj=isfield(v000,'obj');end,if ~isfield(v000.boolean,...
'fcn') || isempty(v000.boolean.fcn),v000.boolean.fcn=isfield(v000,'fcn');end,end
function [v000,v001]=typecast_double_uint64(v002),[v003,v004]=log2(v002);v005 =...
-floor(sign(v002)/2-0.5);v006=v004+1022;v007=abs(v003)*2-1;v000=zeros(size(v002));v000=...
v000+(v005*2^63);v000=v000+(v006*2^52);v000=v000+(v007*2^52);v001=mod(v007*2^52,2^16);v008=...
isinf(v002);v000(v002==0)=0;v000(isnan(v002))=18444492273895866368;v000(v008 & v002>0)=...
9218868437227405312;v000(v008 & v002<0)=18442240474082181120;v001(v002==0)=0;v001(isnan(v002))=...
0;v001(v008)=0;end
function [v000,v001]=test_if_scalar_logical(v001),persistent v002,if isempty(v002),v002={true,...
false;1,0;'on','off';'enable','disable';'enabled','disabled'};try v002(end+1,:)=...
eval('{"on","off"}');catch,end,end,v000=true;try if isa(v001,'char') || isa(v001,'string'),try ...
v001=lower(v001);catch,end,end,for v003=1:size(v002,1),for v004=1:2,if isequal(v001,v002{v003,...
v004}),v001=v002{1,v004};return,end,end,end,if isa(v001,'matlab.lang.OnOffSwitchState'),v001=...
logical(v001);return,end,catch,end,v000=false;end
function v000=PatternReplace(v001,v002,v003),v000=v001(:)';if numel(v002)==0,v004=...
false(size(v001));elseif numel(v003)>numel(v002),error('not implemented (padding required)'),...
else,v004=true(size(v001));for v005=1:numel(v002),v006=find(v001==v002(v005));v006=v006-v005+1;
v006(v006<1)=[];v007=false(size(v004));v007(v006)=true;v004= v004 & v007;if ~any(v004),break,...
end,end,end,v006=find(v004);if ~isempty(v006),for v005=1:numel(v003),v000(v006+v005-1)=...
v003(v005);end,if numel(v003)==0,v005=0;end,if numel(v002)>v005,v006=v006(:);v008=...
(v005+1):numel(v002);v009=bsxfun_plus(v006,v008-1);v000(v009(:))=[];end,end,end
function v000=AddMissing(v001,v000),v002=fieldnames(v001);v003=fieldnames(v000);for v004=...
find(~ismember(v002,v003)).',v005=v002{v004};v000.(v005)=v001.(v005);end,end
function [v000,v001,v002]=BlandAltman_values(v003,v004,v005),persistent v006,if isempty(v006),...
if ifversion('>=',7.0,'Octave','>',3),v006 = eval('@(a) -sqrt(2) * erfcinv(a*2)');else,v006=...
inline('-sqrt(2) * erfcinv(a*2)','a');end,end,v007=v004(:)-v003(:);v007(isnan(v007))=[];v008=...
numel(v007);v000=mean(v007);v009=std(v007);v010=sqrt(v009^2/v008);v011=sqrt(3*v009^2/v008);v012=...
t_inv(v005/2,v008-1);v013=v006(1-v005/2);v002.mu=[v000-v010 v000+v010];v001=[v000-v013*v009 ...
v000+v013*v009];v002.loa_lower=[v001(1)-(v012*v011) v001(1)+(v012*v011)];v002.loa_upper=...
[v001(2)-(v012*v011) v001(2)+(v012*v011)];end
function v000=t_inv(v001,v002),persistent v003,if isempty(v003),v003 = exist('OCTAVE_VERSION', ...
'builtin') ~= 0;end,persistent v004,if v003,if isempty(v004),v005=...
eval('@(t,v) (1-betainc(v/(v+t^2), v/2, 0.5));');v006=eval(['@(t,v) 1-(1-' var2str(v005) ...
'(t,v))/2;']);v004=eval(['@(alpha,v) fzero(@(tval) (max(alpha,(1-alpha)) - ' var2str(v006) ...
'(tval,v)), 5);']);end,v000=v004(v001,v002);else,v000=fzero(@t_inv_reimplementation___local_fun,...
5,optimset('fzero'),v001,v002);end,end
function v000=char2cellstr(v001,v002),v003=isa(v001,'char');v001=int32(v001);if nargin<2,if ...
any(v001==13),v001=PatternReplace(v001,int32([13 10]),int32(-10));v001(v001==13)=-10;end,...
v001(v001==10)=-10;else,for v004=1:numel(v002),v001=PatternReplace(v001,int32(v002{v004}),...
int32(-10));end,end,v005=[0 find(v001==-10) numel(v001)+1];v000=cell(numel(v005)-1,1);for v004=...
1:numel(v000),v006=(v005(v004 )+1);v007=(v005(v004+1)-1);v000{v004}=v001(v006:v007);end,if v003,...
for v004=1:numel(v000),v000{v004}= char(v000{v004});end,else,for v004=1:numel(v000),v000{v004}=...
uint32(v000{v004});end,end,end
function v000=ComputeNonCryptHash(v001,varargin),if nargin<1,...
error('HJW:ComputeNonCryptHash:InputIncorrect','At least 1 input required.'),end,if nargin==2 ...
&& isa(varargin{1},'struct') && varargin{1}.SkipInputParse,v002=varargin{1};else,[v003,v002,...
v004]=ComputeNonCryptHash_parse_inputs(varargin{:});if ~v003,rethrow(v004),end,end,...
v002.print_to=v002.print_2__options;v005=v002.HashLength;v006=v002.Version;try v004=[];v001=...
cast_to_uint16_vector(v001,v002);catch v004;if isempty(v004),v004=lasterror;end,if ...
strcmp(v004.identifier,'MATLAB:nomem'),error_(v002.print_to,v004),else,if isfield(v002,'debug') ...
&& v002.debug,v007=sprintf('\n[original error: %s %s]',v004.identifier,v004.message);else,v007=...
'';end,error_(v002.print_to,'HJW:ComputeNonCryptHash:UnwindFailed',...
['The nested input contains an unsupported data type.' v007]),end,end,if mod(numel(v001),...
v005/16),v008=uint16(1:v005/16).'; v008(1:mod(numel(v001),v005/16))=[];v001=[v001;v008];end,if ...
v006==1,v001=ComputeNonCryptHash_shuffle_uint16(v001);v001=...
ComputeNonCryptHash_uint16_to_logical(v001);v001=xor(v001,reshape(v001,[],16).');else,v001=...
ComputeNonCryptHash_shuffle_uint16(v001);v001=ComputeNonCryptHash_uint16_to_logical(v001);v001=...
circshift_by_col(v001);end,v001=mod(sum(reshape(v001,v005,[]),2),2);v001=...
ComputeNonCryptHash_logical_to_uint16(v001);if v002.isSaltCall,v000=v001;return,end,v001=...
ComputeNonCryptHash_add_salt(v001,v002);v000=ComputeNonCryptHash_dec2hex(v001);v000=...
reshape(v000.',1,[]);end
function v000=circshift_by_col(v000),persistent v001,v002=size(v000);if isempty(v001) || ...
any(size(v001)<v002) || isempty(v001{v002(1),v002(2)}),[v003,v004]=meshgrid(1:size(v000,2),...
1:size(v000,1));v005=mod(v003+v004-2,size(v000,1))+1;v006=sub2ind(size(v000),v005,v003);if ...
prod(v002)<=1000,v001{v002(1),v002(2)}=v006;end,else,v006=v001{v002(1),v002(2)};end,v000=...
v000(v006);end
function v000=ComputeNonCryptHash_dec2hex(v001),persistent v002,if isempty(v002),v002=...
upper(dec2hex(0:(-1+2^16),4));end,v001=double(v001)+1;v000=v002(v001,:);end
function v000=ComputeNonCryptHash_shuffle_uint16(v000),v001=65537;v002=479001600;v000 = ...
uint16(mod(double(v000) * v002 , v001));end
function v000=ComputeNonCryptHash_logical_to_uint16(v000),if mod(numel(v000),16),...
v000(16*ceil(numel(v000)/16))=0;end,v001=uint16(2.^(15:-1:0))';v000=uint16(reshape(v000,16,[]));
try v000=v000.*v001;catch,v000=double(v000).*repmat(double(v001),[1 size(v000,2)]);v000=...
uint16(v000);end,v000=uint16(sum(v000,1)).';end
function v000=ComputeNonCryptHash_add_salt(v000,v001),v002=16*numel(v000);v003=v001;
v003.Version=1; v003.HashLength=v002;v003.SkipInputParse=1; v003.isSaltCall=1;v004=...
ComputeNonCryptHash(v000,v003);v004=ComputeNonCryptHash_shuffle_uint16_inv(v004);if ...
v001.Version>1,v004=v004(end:-1:1);end,v000=mod(double(v000).*double(v004),1+2^16);v000=...
uint16(v000);end
function v000=ComputeNonCryptHash_shuffle_uint16_inv(v000),v001=65537;v002=1919;v000=...
uint16(mod(double(v000) * v002,v001));end
function v000=ComputeNonCryptHash_uint16_to_logical(v000),persistent v001,if isempty(v001),v001=...
dec2bin(0:(-1+2^16))=='1';v001=v001.';end,v000=double(v000)+1;v000=v001(:,v000);end
function v000=ComputeNonCryptHash_DefaultsByVersion(v000),if ~isfield(v000,...
're_encode_char_on_Octave'),v000.re_encode_char=v000.Version>=2;end,if ~isfield(v000,...
'string_to_cellstr'),v000.string_to_cellstr=v000.Version>=2;if ~isfield(v000,...
'cast_int64_double'),v000.cast_int64_double=v000.Version==1;end,end,end
function v000=t_inv_reimplementation___tdist1T(v001,v002),v000=...
1-(1-t_inv_reimplementation___tdist2T(v001,v002))/2;end
function [v000,v001,v002]=ComputeNonCryptHash_parse_inputs(varargin),v000=true;v002=struct;
persistent v003,if isempty(v003),v003=struct;v003.HashLength=256;v003.Version=2;
v003.VersionFlag='-v2';v003.SkipInputParse=false;v003.isSaltCall=false;v004=struct;
v003.print_to_con=true;v004.print_to_con=v003.print_to_con;v003.print_to_fid=[];
v004.print_to_fid=v003.print_to_fid;v003.print_to_obj=[];v004.print_to_obj=v003.print_to_obj;
v003.print_to_fcn=[];v004.print_to_fcn=v003.print_to_fcn;v003.print_2__default_options=v004;
v003.print_2__options=validate_print_to__options(v004);end,if nargin==0,v001=...
ComputeNonCryptHash_DefaultsByVersion(v003);return,end,if nargin==1,switch class(varargin{1}),...
case {'char','string'},v001=AddMissing(v003,struct('VersionFlag',char(varargin{1})));case ...
'struct',v001=AddMissing(v003,varargin{1});otherwise,v001=AddMissing(v003,struct('HashLength',...
varargin{1}));end,[v001,v002,v000]=ComputeNonCryptHash_parse_inputs__ValidateInputs(v001);if ...
v000,v001=ComputeNonCryptHash_DefaultsByVersion(v001);end,return,end,try [v001,v002,v005]=...
ComputeNonCryptHash_parse_inputs__UnwindToStruct( struct,v002,~v000,varargin{:});v000=~v005;
catch,v002.identifier='HJW:ComputeNonCryptHash:InputFail';v002.message=...
'Input parsing failed. Maybe a parameter has been entered twice.';v000=false;end,if ~v000,...
return,else ,v001=AddMissing(v003,v001);end,[v001,v002,v000]=...
ComputeNonCryptHash_parse_inputs__ValidateInputs(v001);if v000,v001=...
ComputeNonCryptHash_DefaultsByVersion(v001);end,end
function v000=BlandAltmanPlot(v001, v002, varargin),if nargin<2,if nargin==0,v001=[494,395,516,...
434,476,557,413,442,650,433,417,656,267,478,178,423,427];v002=[512,430,520,428,500,600,364,380,...
658,445,432,626,260,477,259,350,451];else,error('Incorrect number of input argument.'),end,end,...
[v003,v004,v005]=BlandAltmanPlot_parse_inputs(v001,v002,varargin{:});if ~v003,rethrow(v005),...
else,[v006, v007, v008, v009, v010, v011, v012, v013, v014]=deal(v004.StoreToAppdata, ...
v004.alpha, v004.plot_x_mean, v004.plotCI, v004.AddDetailsText, v004.TargetAxes, ...
v004.TextDigitsDisplayed, v004.xxyy, v004.GroupIndex);end,[v015,v016,v017]=...
BlandAltman_values(v001,v002,v007);v000=struct;v000.input.alpha=v007;v000.input.var1=v001;
v000.input.var2=v002;v000.data.mu=v015;v000.data.loa=v016;v000.data.CI=v017;if ...
~isequal(size(v001),size(v002)),v001=v001(:);v002=v002(:);end,if v008,v018=(v001+v002)/2;v019=...
v002-v001;else,v018=v001;v019=v002-v001;end,v000.xxyy=[min(v018) max(v018) min(v019) max(v019)];
v000.xxyy(3)=min(v000.xxyy(3),v017.loa_lower(1));v000.xxyy(4)=max(v000.xxyy(4),...
v017.loa_upper(2));v020=5;v021=[[1 1]*mean(v000.xxyy(1:2)) [1 1]*mean(v000.xxyy(3:4))];
v000.xxyy=v021+(v000.xxyy-v021)*(1+v020/100);if isempty(v013),v013=[NaN NaN NaN NaN];end,...
v013(isnan(v013))=v000.xxyy(isnan(v013));v000.xxyy=v013;v022=get(v011,'NextPlot');set(v011,...
'NextPlot','add'),if ~isempty(v014),v023=[];for v024=unique(v014(:)).',v025=v014==v024;
v000.plot.data(v024)=plot(v018(v025),v019(v025),'.','Parent',v011);if isempty(v023),v023=...
get(v000.plot.data(v024),'Color');else,set(v000.plot.data(v024),'Color',v023);end,end,else,...
v000.plot.data=plot(v018,v019,'.','Parent',v011);end,v000.plot.mean=plot(v013(1:2),v015*[1 1],...
'k','Parent',v011);v000.plot.loa_lo=plot(v013(1:2),v016(1)*[1 1],'k--','Parent',v011);
v000.plot.loa_hi=plot(v013(1:2),v016(2)*[1 1],'k--','Parent',v011);if v009,v026=...
diff(v017.loa_lower)/2;v027=diff(v017.mu)/2;v028=v013(1)+0.05*diff(v013(1:2));v000.plot.CI_lo=...
errorbar(v028,v016(1),v026,'ko');v000.plot.CI_mu=errorbar(v028,v015 ,v027,'ko');v000.plot.CI_hi=...
errorbar(v028,v016(2),v026,'ko');end,set(v011,'NextPlot',v022),axis(v011,v013),if v010,v029=...
v012;v030=v013(2);v031=v015;v032=sprintf('mean: %s',num2str(v031,v029));v000.text.mean=...
text(v030,v031,v032,'Parent',v011,'HorizontalAlignment','right','VerticalAlignment','bottom');
if v009,v032=sprintf('CI: %s - %s',num2str(v017.mu(1),v029),num2str(v017.mu(2),v029));
v000.text.meanCI=text(v030,v031,v032,'Parent',v011,'HorizontalAlignment','right',...
'VerticalAlignment','top');end,v031=v016(2);v032=sprintf('LoA: %s',num2str(v031,v029));
v000.text.loa_hi=text(v030,v031,v032,'Parent',v011,'HorizontalAlignment','right',...
'VerticalAlignment','bottom');if v009,v032=sprintf('CI: %s - %s',num2str(v017.loa_upper(1),...
v029),num2str(v017.loa_upper(2),v029));v000.text.loa_hi_CI=text(v030,v031,v032,'Parent',v011,...
'HorizontalAlignment','right','VerticalAlignment','top');end,v031=v016(1);v032=...
sprintf('LoA: %s',num2str(v031,v029));v000.text.loa_lo=text(v030,v031,v032,'Parent',v011,...
'HorizontalAlignment','right','VerticalAlignment','bottom');if v009,v032=sprintf('CI: %s - %s',...
num2str(v017.loa_lower(1),v029),num2str(v017.loa_lower(2),v029));v000.text.loa_lo_CI=text(v030,...
v031,v032,'Parent',v011,'HorizontalAlignment','right','VerticalAlignment','top');end,end,if ...
v006,setappdata(v011,'HJW___BlandAltmanPlot___data',v000),end,if nargout==0,clear v000,end,end
function [v000,v001,v002]=BlandAltmanPlot_parse_inputs(v003,v004,varargin),v000=false;v001=...
struct;v002=struct('identifier','','message','');if numel(v003)==0 || numel(v003)~=...
max(size(v003)) || ~isnumeric(v003) || numel(size(v003))>2,v002.message=...
'The first input is not a numeric vector.';v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input';return,end,if numel(v004)==0 || numel(v004)~=...
max(size(v004)) || ~isnumeric(v004) || numel(size(v004))>2,v002.message=...
'The second input is not a numeric vector.';v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input';return,end,if numel(v003)~=numel(v004),v002.message=...
'The first and second inputs do no match.';v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input';return,end,v005.StoreToAppdata=true;v005.alpha=0.05;
v005.plot_x_mean=true;v005.plotCI=true;v005.GroupIndex=[];v005.AddDetailsText=true;
v005.TextDigitsDisplayed=4;v005.xxyy=[];v005.TargetAxes=[];v005.Parent=[];if nargin==2,v001=...
v005;v000=true;v001=BlandAltmanPlot_parse_inputs_ensureParentAxesExists(v001);return,end,v006=...
nargin==3 && isa(varargin{1},'struct');v007=mod(nargin,2)==0 && all(cellfun('isclass',...
varargin(1:2:end),'char'));if ~( v006 || v007 ),v002.message=...
['The third input (options) is expected to be either a ','struct,',char(10),...
'or consist of Name,Value pairs.'];v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input_options';return,end,if v007,for v008=1:2:numel(varargin),...
try v001.(varargin{v008})=varargin{v008+1};catch,v002.message=...
'Parsing of Name,Value pairs failed.';v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input_NameValue';return,end,end,else,v001=varargin{1};end,v009=...
fieldnames(v001);for v010=1:numel(v009),v011=v009{v010};v012=v001.(v011);v002.identifier=...
['HJW:BlandAltmanPlot:incorrect_input_opt_' lower(v011)];switch v011,case 'alpha',if ...
~isnumeric(v012) || numel(v012)~=1 || v012<0 || v012>1 || isnan(v012),v002.message=...
'The value of options.alpha is not a scalar between 0 and 1.';return,end,case {'StoreToAppdata',...
'plotCI','AddDetailsText','plot_x_mean'},[v013,v012]=test_if_scalar_logical(v012);v001.(v011)=...
v012;if ~v013,v002.message=['The value of options.',v011,' is not a logical scalar.'];return,...
end,case 'TextDigitsDisplayed',v014=false;if isnumeric(v012),if numel(v012)~=1 || double(v012)~=...
round(double(v012)),v014=true;end,elseif isa(v012,'char'),try v015=num2str(123.45,v012);if ...
~isa(v015,'char') || numel(v015)==0,v014=true;end,catch,v014=true;end,else,v014=true;end,if ...
v014,v002.message='The value of options.TextDigitsDisplayed is not an integer scalar.';return,...
end,case 'xxyy',if ~isnumeric(v012) || (numel(v012)~=4 && ~isempty(v012)) || ( ~isempty(v012) ...
&& ( v012(2)<=v012(1) || v012(4)<=v012(3) ) ),v002.message=...
['The value of options.xxyy is neither ','a valid 2D axis range, nor empty.'];return,end,case ...
{'TargetAxes','Parent'},try if ~strcmp(get(v012,'Type'),'axes') && ~isempty(v012),v002.message=...
['The value of options.',v011,' is not an axes object or is not empty.'];return,end,catch,if ...
~isempty(v012),v002.message=['The value of options.',v011,...
' is not an axes object or is not empty.'];return,end,end,case 'GroupIndex',if isempty(v012),...
continue,end,try if numel(v012)~=numel(v003),error('trigger'),end,v016=zeros(1,max(v012(:)));
v016(v012)=1;if sum(v016)==0,error('trigger'),end,catch,v002.message=...
['The values in GroupIndex must be valid array indices',char(10),...
'and the number of elements must match the data.'];end,otherwise,v002.message=...
sprintf('Name,Value pair not recognized: %s',v011);v002.identifier=...
'HJW:BlandAltmanPlot:incorrect_input_NameValue';return,end,end,v009=fieldnames(v005);for v010=...
1:numel(v009),if ~isfield(v001,v009(v010)),v001.(v009{v010})=v005.(v009{v010});end,end,if ...
isempty(v001.TargetAxes),v001=BlandAltmanPlot_parse_inputs_ensureParentAxesExists(v001);end,...
v000=true;v002=[];end
function v000=BlandAltmanPlot_parse_inputs_ensureParentAxesExists(v000),v001=v000.Parent;v002=...
v000.TargetAxes;v003={[],v002;v001,v001};v004=v003{2-isempty(v001),2-isempty(v002)};if ...
isempty(v004),v004=gca;end,v000.Parent=v004;v000.TargetAxes=v004;end
function v000=cast_to_uint16_vector__floats(v000),v001=size(v000).';v002=class(v000);[v003,...
v004]=typecast_double_uint64(double(v000));v005=mod(v003,2^16);v003=v003-v005;v003=v003/2^16;
v004=v004.';v006 =mod(v003,2^16);v003=v003-v006; v003=v003/2^16;v006=v006.';v007 =mod(v003,...
2^16);v003=v003-v007; v003=v003/2^16;v007=v007.';v008 =mod(v003,2^16); v008=v008.';v000=[v008;
v007;v006;v004];v000=uint16(v000(:));v000=[v000;uint16(v002.');uint16(mod(v001,2^16))];end
function v000=cast_to_uint16_vector__logical(v000),v001=size(v000).';v000=v000(:);if ...
mod(numel(v000),16),v000(16*ceil(numel(v000)/16))=0;end,v002=uint16(2.^(15:-1:0))';v000=...
uint16(reshape(v000,16,[]));try v000=v000.*v002;catch,v000=double(v000).*repmat(double(v002),[1 ...
size(v000,2)]);v000=uint16(v000);end,v000=uint16(sum(v000,1)).';v000=[v000;uint16(mod(v001,...
2^16))];end
function v000=cast_to_uint16_vector__integer(v000,v001),v002=size(v000).';v000=v000(:);
persistent v003,if isempty(v003),v003=ifversion('>=','R2010b','Octave','>',0);end,v004=...
class(v000);v005=~v001.cast_int64_double && v003 && v004(end)=='4';if ~v005,if ...
any(abs(double(v000(:)))>2^52),warning_(v001,'HJW:ComputeNonCryptHash:int64rounding',...
['int64 and uint64 will be rounded pre-R2010b, resulting in rounding.',char(10),...
'This will result in a hash that is different from newer releases.']),end,end,if v005,if ...
v004(1)~='u',v006=v000>0;v007=-int64(-inf);v008=uint64(v000+v007+1);v008(v006)=...
uint64(v000(v006))+uint64(v007)+1;v000=v008;end,elseif v004(1)~='u',v000=...
double(v000)-double(eval([v004 '(-inf)']));else,v000=double(v000);end,switch v004(end),case '8',...
if mod(numel(v000),2),v000(end+1)=0;end,v000=reshape(v000,[],2);v000=v000(:,1)*255+v000(:,2);
v000=uint16(v000);case '6',v000=uint16(v000);case '2',v009=floor(v000/2^16);v009=v009.';v010=...
mod(v000,2^16); v010=v010.';v000=[v009;v010];v000=uint16(v000(:));case '4',v011=v000;v012=...
mod(v011,2^16);v011=v011-v012;v011=v011/2^16;v012=v012.';v013=mod(v011,2^16);v011=v011-v013;
v011=v011/2^16;v013=v013.';v010=mod(v011,2^16);v011=v011-v010;v011=v011/2^16;v010=v010.';v009=...
mod(v011,2^16); v009=v009.';v000=[v009;v010;v013;v012];v000=uint16(v000(:));end,v000=[v000;
uint16(v004.');uint16(mod(v002,2^16))];end
function v000=t_inv_reimplementation___local_fun(v001,v002,v003),v000=max(v002,...
(1-v002))-t_inv_reimplementation___tdist1T(v001,v003);end
function v000=bsxfun_plus(v001,v002),try v000=v001+v002;catch,try v000=bsxfun(@plus,v001,v002);
catch,v003=size(v001); v004=size(v002);v001=repmat(v001,max(1,v004./v003)); v002=repmat(v002,...
max(1,v003./v004));v000=v001+v002;end,end,end
function v000=cast_to_uint16_vector__cell(v000,v001),v002=size(v000).';v000=v000(:);for v003=...
1:numel(v000),if numel(v000{v003})==0,v004=double(class(v000{v003})');v000{v003}=uint16([0;v004;
size(v000{v003})']);continue,end,switch class(v000{v003}),case {'double','single'},v000{v003}=...
cast_to_uint16_vector__floats(v000{v003});case 'logical',v000{v003}=...
cast_to_uint16_vector__logical(v000{v003});case {'uint8','uint16','uint32','uint64','int8',...
'int16','int32','int64'},v000{v003}=cast_to_uint16_vector__integer(v000{v003},v001);case 'char',...
v000{v003}=cast_to_uint16_vector__char(v000{v003},v001);case 'string',v000{v003}=...
cast_to_uint16_vector__string(v000{v003},v001);case 'cell',v000{v003}=...
cast_to_uint16_vector__cell(v000{v003},v001);case 'struct',v000{v003}=...
cast_to_uint16_vector__struct(v000{v003},v001);case {'gpuArray','tall'},v000{v003}=...
cast_to_uint16_vector__cell({gather(v000{v003})},v001);otherwise,error_(v001.print_to,...
'HJW:cast_to_uint16_vector:nosupport','Unsupported data type in nested variable'),end,end,v000=...
cell2mat(v000);v000=[v000;uint16(mod(v002,2^16))];end
function v000=cast_to_uint16_vector(v000,v001),if isa(v000,'uint16'),v002='uint16';v003=...
size(v000).';v000=reshape(v000,[],1);v000=[v000;uint16(v002.');uint16(mod(v003,2^16))];return,...
end,v000=cast_to_uint16_vector__cell({v000},v001);v000([end-1 end])=[];end
function [v000,v001,v002]=ComputeNonCryptHash_parse_inputs__ValidateInputs(v000),v002=true;v001=...
struct;try v003=str2double(v000.VersionFlag(3:end));if isnan(v003) || round(v003)~=v003 || ...
v003>2,error('trigger');end,v000.Version=v003;catch,v001.identifier=...
'HJW:ComputeNonCryptHash:InputIncorrect';v001.message=...
'Version input incorrect. Must be ''-v1'', ''-v2''.';v002=false;return,end,v004=v000.HashLength;
if numel(v004)~=1 || ~isnumeric(v004) || mod(v004,16)~=0 || v004<16,v001.identifier=...
'HJW:ComputeNonCryptHash:InputIncorrect';v001.message=...
'Second input (hash length) must be a multiple of 16.';v002=false;return,end,for v005=...
fieldnames(v000.print_2__default_options),if ~isequal(v000.(v005{1}),...
v000.print_2__default_options.(v005{1})),[v006,v001]=validate_print_to__options(v000);if ...
isempty(v006),v001.identifier='HJW:ComputeNonCryptHash:PrintToIncorrect';v002=false;return,end,...
v000.print_2__options=v006;break,end,end,end
function [v000,v001,v002]=ComputeNonCryptHash_parse_inputs__UnwindToStruct(v000,v001,v002,...
varargin),if v002 || numel(varargin)==0,return,end,v003=varargin{1};if isa(v003,'struct'),v004=...
fieldnames(v000);v005=fieldnames(v003);v006=unique([v004;v005]);if numel(v004)+numel(v005) ~= ...
numel(v006),v002=true;return,end,v000=AddMissing(v000,v003);varargin(1)=[];elseif isa(v003,...
'char') || isa(v003,'string'),try if isa(v003,'string'),v003=char(v003);end,if strcmpi('-v',...
v003(1:2)),if isfield(v000,'VersionFlag'),error('trigger'),end,v000.VersionFlag=v003;
varargin(1)=[];else,if isfield(v000,v003),error('trigger'),end,v000.(v003)=varargin{2};
varargin(1:2)=[];end,catch,v002=true;return,end,else,if isfield(v000,'HashLength'),v002=true;
return,end,v000.HashLength=v003;varargin(1)=[];end,[v000,v001,v002]=...
ComputeNonCryptHash_parse_inputs__UnwindToStruct(v000,v001,v002,varargin{:});end
function error_(v001,varargin),persistent v000,if isempty(v000),v000=func2str(@error_);end,if ...
isempty(v001),v001=struct;end,v001=parse_warning_error_redirect_options(v001);[v002,v003,v004,...
v005]=parse_warning_error_redirect_inputs(varargin{:});v006=struct('identifier',v002,'message',...
v003,'stack',v004);if v001.boolean.obj,v007=v003;while v007(end)==10,v007(end)='';end,if ...
any(v007==10),v007=char2cellstr(['Error: ' v007]);else,v007=['Error: ' v007];end,for v008=...
v001.obj(:).',try set(v008,'String',v007);catch,end,end,end,if v001.boolean.fid,for v009=...
v001.fid(:).',try fprintf(v009,'Error: %s\n%s',v003,v005);catch,end,end,end,if v001.boolean.fcn,...
if ismember(v000,{v004.name}),error('prevent recursion'),end,for v010=v001.fcn(:).',if ...
isfield(v010,'data'),try feval(v010.h,'error',v006,v010.data);catch,end,else,try feval(v010.h,...
'error',v006);catch,end,end,end,end,rethrow(v006),end
function [v000,v001]=get_trace(v002,v001),if nargin==0,v002=1;end,if nargin<2, v001=dbstack;end,...
v001(1:v002)=[];if ~isfield(v001,'file'),for v003=1:numel(v001),v004=v001(v003).name;if ...
strcmp(v004(end),')'),v005=strfind(v004,'(');v006=v004( (v005(end)+1):(end-1) );v007=...
v004(1:(v005(end)-2));else,v007=v004;[v008,v006]=fileparts(v004);end,[v008,v001(v003).file]=...
fileparts(v007);v001(v003).name=v006;end,end,persistent v009,if isempty(v009),v009=...
exist('OCTAVE_VERSION','builtin');end,if v009,for v003=1:numel(v001),[v008,v001(v003).file]=...
fileparts(v001(v003).file);end,end,v010=v001;v011='>';v000=cell(1,numel(v010)-1);for v003=...
1:numel(v010),[v012,v010(v003).file,v013]=fileparts(v010(v003).file);if v003==numel(v010),...
v010(v003).file='';end,if strcmp(v010(v003).file,v010(v003).name),v010(v003).file='';end,if ...
~isempty(v010(v003).file),v010(v003).file=[v010(v003).file '>'];end,v000{v003}=...
sprintf('%c In %s%s (line %d)\n',v011,v010(v003).file,v010(v003).name,v010(v003).line);v011=' ';
end,v000=horzcat(v000{:});end
function v000=ifversion(v001,v002,v003,v004,v005),persistent v006 v007 v008,if isempty(v006),...
v008=exist('OCTAVE_VERSION', 'builtin');v006=version;v009=strfind(v006,'.');if numel(v009)~=1,...
v006(v009(2):end)='';v009=v009(1);end,v006=[str2double(v006(1:(v009-1))) ...
str2double(v006((v009+1):end))];v006=v006(1)+v006(2)/100;v006=round(100*v006);v007={ 'R13' 605;
'R13SP1' 605;'R13SP2' 605;'R14' 700;'R14SP1' 700;'R14SP2' 700;'R14SP3' 701;'R2006a' 702;
'R2006b' 703;'R2007a' 704;'R2007b' 705;'R2008a' 706;'R2008b' 707;'R2009a' 708;'R2009b' 709;
'R2010a' 710;'R2010b' 711;'R2011a' 712;'R2011b' 713;'R2012a' 714;'R2012b' 800;'R2013a' 801;
'R2013b' 802;'R2014a' 803;'R2014b' 804;'R2015a' 805;'R2015b' 806;'R2016a' 900;'R2016b' 901;
'R2017a' 902;'R2017b' 903;'R2018a' 904;'R2018b' 905;'R2019a' 906;'R2019b' 907;'R2020a' 908;
'R2020b' 909;'R2021a' 910};end,if v008,if nargin==2,warning('HJW:ifversion:NoOctaveTest',...
['No version test for Octave was provided.',char(10),...
'This function might return an unexpected outcome.']),if isnumeric(v002),v010=...
0.1*v002+0.9*fix(v002);v010=round(100*v010);else,v011=ismember(v007(:,1),v002);if sum(v011)~=1,...
warning('HJW:ifversion:NotInDict','The requested version is not in the hard-coded list.'),v000=...
NaN;return,else,v010=v007{v011,2};end,end,elseif nargin==4,[v001,v010]=deal(v003,v004);v010=...
0.1*v010+0.9*fix(v010);v010=round(100*v010);else,[v001,v010]=deal(v004,v005);v010=...
0.1*v010+0.9*fix(v010);v010=round(100*v010);end,else,if isnumeric(v002),v010=...
0.1*v002+0.9*fix(v002);v010=round(100*v010);else,v011=ismember(v007(:,1),v002);if sum(v011)~=1,...
warning('HJW:ifversion:NotInDict','The requested version is not in the hard-coded list.'),v000=...
NaN;return,else,v010=v007{v011,2};end,end,end,switch v001,case '==', v000= v006 == v010;case ...
'<' , v000= v006 < v010;case '<=', v000= v006 <= v010;case '>' , v000= v006 > v010;case '>=', ...
v000= v006 >= v010;end,end
function v000=cast_to_uint16_vector__char(v000,v001),persistent v002,if isempty(v002),v002 = ...
exist('OCTAVE_VERSION', 'builtin') ~= 0;end,if v002 && v001.re_encode_char,v003 = size(v000,1)==...
numel(v000);if v003,v000=v000.';end,v000=cellstr(v000);for v004=1:numel(v000),v000{v004}=...
unicode_to_char(UTF8_to_unicode(v000{v004},v001.print_to),true);end,v005=cellfun('length',v000);
v006=max(v005);for v004=find(v005<v006),v000{v004}( (numel(v000{v004})+1) : v006)=uint16(' ');
end,v000=cell2mat(v000);if v003,v000=v000.';end,end,v007=size(v000).';v000=v000(:);v000=...
uint16(v000);v000=[v000;uint16(mod(v007,2^16))];end
function v000=unicode_to_char(v001,v002),persistent v003,if isempty(v003),v003 = ...
exist('OCTAVE_VERSION', 'builtin') ~= 0;end,if nargin==1,v002=~v003;end,if v002,if ...
all(v001<65536),v000=uint16(v001);v000=reshape(v000,1,numel(v000));else,[v004,v005,v006]=...
unique(v001);v000=cell(1,numel(v001));for v007=1:numel(v004),v008=unicode_to_UTF16(v004(v007));
v008=uint16(v008);v000(v006==v007)={v008};end,v000=cell2mat(v000);end,if ~v003,v000=char(v000);
end,else,if all(v001<128),v000=char(v001);v000=reshape(v000,1,numel(v000));else,[v004,v005,...
v006]=unique(v001);v000=cell(1,numel(v001));for v007=1:numel(v004),v008=...
unicode_to_UTF8(v004(v007));v008=uint8(v008);v000(v006==v007)={v008};end,v000=cell2mat(v000);
v000=char(v000);end,end,end
function v000=unicode_to_UTF16(v001),if v001<65536,v000=v001;return,end,v002=double(v001)-65536;
v002=dec2bin(v002,20);v000=bin2dec(['110110' v002(1:10);'110111' v002(11:20)]).';end
function [v000,v001,v002]=UTF8_to_unicode_internal(v000,v003),v001='success';v002=...
struct('identifier','HJW:UTF8_to_unicode:notUTF8','message','Input is not UTF-8.');persistent ...
v004,if isempty(v004),v004 = exist('OCTAVE_VERSION', 'builtin') ~= 0;end,if any(v000>255),v001=...
'error';if v003,return,end,elseif all(v000<128),return,end,for v005=4:-1:2,v006=...
bin2dec([repmat('1',1,v005) repmat('0',1,8-v005)]);v007=v000>=v006 & v000<256;if any(v007),v007=...
find(v007);v007=v007(:).';if numel(v000)<(max(v007)+v005-1),v001='error';if v003,return,end,...
v007( (v007+v005-1)>numel(v000) )=[];end,if ~isempty(v007),v008=bsxfun_plus(v007 , ...
(0:(v005-1)).' );v008=v008.';v007=v000(v008);end,else,v007=[];end,v009=[repmat('1',1,v005-1) ...
repmat('10',1,v005)];v010=unique([1:(v005+1) 1:8:(8*v005) 2:8:(8*v005)]);if numel(v007)>0,v007=...
unique(v007,'rows');v011=mat2cell(v007,ones(size(v007,1),1),v005);for v012=1:numel(v011),v013=...
dec2bin(double(v011{v012}))';if ~strcmp(v009,v013(v010)),v001='error';if v003,return,end,...
continue,end,v013(v010)='';if ~v004,v014=uint32(bin2dec(v013 ));else,v014=...
uint32(bin2dec(v013.'));end,v000=PatternReplace(v000,v011{v012},v014);end,end,end,end
function v000=unicode_to_UTF8(v001),if v001<128,v000=v001;return,end,persistent v002,if ...
isempty(v002),v002=struct;v002.limits.lower=hex2dec({'0000','0080','0800', '10000'});
v002.limits.upper=hex2dec({'007F','07FF','FFFF','10FFFF'});v002.scheme{2}='110xxxxx10xxxxxx';
v002.scheme{2}=reshape(v002.scheme{2}.',8,2);v002.scheme{3}='1110xxxx10xxxxxx10xxxxxx';
v002.scheme{3}=reshape(v002.scheme{3}.',8,3);v002.scheme{4}='11110xxx10xxxxxx10xxxxxx10xxxxxx';
v002.scheme{4}=reshape(v002.scheme{4}.',8,4);for v003=2:4,v002.scheme_pos{v003}=...
find(v002.scheme{v003}=='x');v002.bits(v003)=numel(v002.scheme_pos{v003});end,end,v004=...
find(v002.limits.lower<=v001 & v001<=v002.limits.upper);v000=v002.scheme{v004};v005=...
v002.scheme_pos{v004};v003=dec2bin(v001,v002.bits(v004));v000(v005)=v003;v000=bin2dec(v000.').';
end
function [v000,v001,v002]=UTF8_to_unicode(v003,v004),if nargin<2,v004=[];end,v005= nargout==1 ;
v003=uint32(v003);[v002,v006,v007]=UTF8_to_unicode_internal(v003,v005);if strcmp(v006,...
'success'),v001=true;v000=v002;elseif strcmp(v006,'error'),v001=false;if v005,error_(v004,v007),...
end,v000=v003;end,end
function v000=cast_to_uint16_vector__string(v000,v001),if v001.string_to_cellstr,v000=...
cellstr(v000);v000=cast_to_uint16_vector__cell(v000,v001);else,v000=char(v000);v000=...
cast_to_uint16_vector__char(v000,v001);end,end
function v000=cast_to_uint16_vector__struct(v000,v001),v002=size(v000).';v000=v000(:);v003=...
fieldnames(v000);v004=cell(2,numel(v003));for v005=1:numel(v003),v004{1,v005}=v003{v005};v004{2,...
v005}={v000.(v003{v005})};end,v000=cast_to_uint16_vector__cell(v004,v001);v000=[v000;
uint16(mod(v002,2^16))];end
function [v000,v001]=validate_print_to__options(v002,v001),if nargin<2,v001=struct;end,if ...
~isfield(v002,'print_to_con'),v002.print_to_con=[];end,if ~isfield(v002,'print_to_fid'),...
v002.print_to_fid=[];end,if ~isfield(v002,'print_to_obj'),v002.print_to_obj=[];end,if ...
~isfield(v002,'print_to_fcn'),v002.print_to_fcn=[];end,v003=true;v000=struct;v004=...
v002.print_to_fid;if isempty(v004),v000.boolean.fid=false;else,v003=false;v000.boolean.fid=true;
v000.fid=v004;for v005=1:numel(v004),try v006=ftell(v004(v005));catch,v006=-1;end,if ...
v004(v005)~=1 && v006==-1,v001.message=['Invalid print_to_fid parameter:',char(10),...
'should be a valid file identifier or 1.'];v000=[];return,end,end,end,v004=v002.print_to_obj;if ...
isempty(v004),v000.boolean.obj=false;else,v003=false;v000.boolean.obj=true;v000.obj=v004;for ...
v005=1:numel(v004),try v007=get(v004(v005),'String' );set( v004(v005),'String','' );set( ...
v004(v005),'String',v007);catch,v001.message=['Invalid print_to_obj parameter:',char(10),...
'should be a handle to an object with a writeable String property.'];v000=[];return,end,end,end,...
v004=v002.print_to_fcn;if isempty(v004),v000.boolean.fcn=false;else,v003=false;try for v005=...
1:numel(v004),if ~ismember(class(v004(v005).h),{'function_handle','inline'}) || ...
numel(v004(v005).h)~=1,error('trigger error'),end,end,catch,v001.message=...
['Invalid print_to_fcn parameter:',char(10),...
'should be a struct with the h field containing a function handle,',char(10),...
'anonymous function or inline function.'];v000=[];return,end,end,v004=v002.print_to_con;if ...
isempty(v004),v000.boolean.con=v003;else,[v008,v000.boolean.con]=test_if_scalar_logical(v004);
if ~v008,v001.message=['Invalid print_to_con parameter:',char(10),...
'should be a scalar logical.'];v000=[];return,end,end,end
function varargout=var2str(varargin),v000= nargin~=max(1,nargout) ;if ~v000,varargout=...
cell(nargin,1);for v001=1:nargin,try varargout{v001}=inputname(v001);catch,varargout{v001}='';
end,if isempty(varargout{v001}),v000=true;break,end,end,end,if v000,...
error('Invalid input and/or output.'),end,end
function warning_(v001,varargin),persistent v000,if isempty(v000),v000=func2str(@warning_);end,...
if isempty(v001),v001=struct;end,v001=parse_warning_error_redirect_options(v001);[v002,v003,...
v004,v005]=parse_warning_error_redirect_inputs(varargin{:});v006=struct('identifier',v002,...
'message',v003,'stack',v004);if v001.boolean.con,if ~isempty(v002),warning(v002,'%s',v003),else,...
warning(v003), end,else,if ~isempty(v002),lastwarn(v003,v002); else,lastwarn(v003),end,end,if ...
v001.boolean.obj,v007=v003;while v007(end)==10,v007(end)=[];end,if any(v007==10),v007=...
char2cellstr(['Warning: ' v007]);else,v007=['Warning: ' v007];end,set(v001.obj,'String',v007),...
for v008=v001.obj(:).',try set(v008,'String',v007);catch,end,end,end,if v001.boolean.fid || ...
v001.boolean.fcn,v009=2;[v005,v004]=get_trace(v009);end,if v001.boolean.fid,for v010=...
v001.fid(:).',try fprintf(v010,'Warning: %s\n%s',v003,v005);catch,end,end,end,if ...
v001.boolean.fcn,if ismember(v000,{v004.name}),error('prevent recursion'),end,for v011=...
v001.fcn(:).',if isfield(v011,'data'),try feval(v011.h,'warning',v006,v011.data);catch,end,else,...
try feval(v011.h,'warning',v006);catch,end,end,end,end,end