annotate toolboxes/FullBNT-1.0.7/KPMstats/distchck.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function [errorcode,out1,out2,out3,out4] = distchck(nparms,arg1,arg2,arg3,arg4)
wolffd@0 2 %DISTCHCK Checks the argument list for the probability functions.
wolffd@0 3
wolffd@0 4 % B.A. Jones 1-22-93
wolffd@0 5 % Copyright (c) 1993-98 by The MathWorks, Inc.
wolffd@0 6 % $Revision: 1.1.1.1 $ $Date: 2005/04/26 02:29:18 $
wolffd@0 7
wolffd@0 8 errorcode = 0;
wolffd@0 9
wolffd@0 10 if nparms == 1
wolffd@0 11 out1 = arg1;
wolffd@0 12 return;
wolffd@0 13 end
wolffd@0 14
wolffd@0 15 if nparms == 2
wolffd@0 16 [r1 c1] = size(arg1);
wolffd@0 17 [r2 c2] = size(arg2);
wolffd@0 18 scalararg1 = (prod(size(arg1)) == 1);
wolffd@0 19 scalararg2 = (prod(size(arg2)) == 1);
wolffd@0 20 if ~scalararg1 & ~scalararg2
wolffd@0 21 if r1 ~= r2 | c1 ~= c2
wolffd@0 22 errorcode = 1;
wolffd@0 23 return;
wolffd@0 24 end
wolffd@0 25 end
wolffd@0 26 if scalararg1
wolffd@0 27 out1 = arg1(ones(r2,1),ones(c2,1));
wolffd@0 28 else
wolffd@0 29 out1 = arg1;
wolffd@0 30 end
wolffd@0 31 if scalararg2
wolffd@0 32 out2 = arg2(ones(r1,1),ones(c1,1));
wolffd@0 33 else
wolffd@0 34 out2 = arg2;
wolffd@0 35 end
wolffd@0 36 end
wolffd@0 37
wolffd@0 38 if nparms == 3
wolffd@0 39 [r1 c1] = size(arg1);
wolffd@0 40 [r2 c2] = size(arg2);
wolffd@0 41 [r3 c3] = size(arg3);
wolffd@0 42 scalararg1 = (prod(size(arg1)) == 1);
wolffd@0 43 scalararg2 = (prod(size(arg2)) == 1);
wolffd@0 44 scalararg3 = (prod(size(arg3)) == 1);
wolffd@0 45
wolffd@0 46 if ~scalararg1 & ~scalararg2
wolffd@0 47 if r1 ~= r2 | c1 ~= c2
wolffd@0 48 errorcode = 1;
wolffd@0 49 return;
wolffd@0 50 end
wolffd@0 51 end
wolffd@0 52
wolffd@0 53 if ~scalararg1 & ~scalararg3
wolffd@0 54 if r1 ~= r3 | c1 ~= c3
wolffd@0 55 errorcode = 1;
wolffd@0 56 return;
wolffd@0 57 end
wolffd@0 58 end
wolffd@0 59
wolffd@0 60 if ~scalararg3 & ~scalararg2
wolffd@0 61 if r3 ~= r2 | c3 ~= c2
wolffd@0 62 errorcode = 1;
wolffd@0 63 return;
wolffd@0 64 end
wolffd@0 65 end
wolffd@0 66
wolffd@0 67 if ~scalararg1
wolffd@0 68 out1 = arg1;
wolffd@0 69 end
wolffd@0 70 if ~scalararg2
wolffd@0 71 out2 = arg2;
wolffd@0 72 end
wolffd@0 73 if ~scalararg3
wolffd@0 74 out3 = arg3;
wolffd@0 75 end
wolffd@0 76 rows = max([r1 r2 r3]);
wolffd@0 77 columns = max([c1 c2 c3]);
wolffd@0 78
wolffd@0 79 if scalararg1
wolffd@0 80 out1 = arg1(ones(rows,1),ones(columns,1));
wolffd@0 81 end
wolffd@0 82 if scalararg2
wolffd@0 83 out2 = arg2(ones(rows,1),ones(columns,1));
wolffd@0 84 end
wolffd@0 85 if scalararg3
wolffd@0 86 out3 = arg3(ones(rows,1),ones(columns,1));
wolffd@0 87 end
wolffd@0 88 out4 =[];
wolffd@0 89
wolffd@0 90 end
wolffd@0 91
wolffd@0 92 if nparms == 4
wolffd@0 93 [r1 c1] = size(arg1);
wolffd@0 94 [r2 c2] = size(arg2);
wolffd@0 95 [r3 c3] = size(arg3);
wolffd@0 96 [r4 c4] = size(arg4);
wolffd@0 97 scalararg1 = (prod(size(arg1)) == 1);
wolffd@0 98 scalararg2 = (prod(size(arg2)) == 1);
wolffd@0 99 scalararg3 = (prod(size(arg3)) == 1);
wolffd@0 100 scalararg4 = (prod(size(arg4)) == 1);
wolffd@0 101
wolffd@0 102 if ~scalararg1 & ~scalararg2
wolffd@0 103 if r1 ~= r2 | c1 ~= c2
wolffd@0 104 errorcode = 1;
wolffd@0 105 return;
wolffd@0 106 end
wolffd@0 107 end
wolffd@0 108
wolffd@0 109 if ~scalararg1 & ~scalararg3
wolffd@0 110 if r1 ~= r3 | c1 ~= c3
wolffd@0 111 errorcode = 1;
wolffd@0 112 return;
wolffd@0 113 end
wolffd@0 114 end
wolffd@0 115
wolffd@0 116 if ~scalararg1 & ~scalararg4
wolffd@0 117 if r1 ~= r4 | c1 ~= c4
wolffd@0 118 errorcode = 1;
wolffd@0 119 return;
wolffd@0 120 end
wolffd@0 121 end
wolffd@0 122
wolffd@0 123 if ~scalararg3 & ~scalararg2
wolffd@0 124 if r3 ~= r2 | c3 ~= c2
wolffd@0 125 errorcode = 1;
wolffd@0 126 return;
wolffd@0 127 end
wolffd@0 128 end
wolffd@0 129
wolffd@0 130 if ~scalararg4 & ~scalararg2
wolffd@0 131 if r4 ~= r2 | c4 ~= c2
wolffd@0 132 errorcode = 1;
wolffd@0 133 return;
wolffd@0 134 end
wolffd@0 135 end
wolffd@0 136
wolffd@0 137 if ~scalararg3 & ~scalararg4
wolffd@0 138 if r3 ~= r4 | c3 ~= c4
wolffd@0 139 errorcode = 1;
wolffd@0 140 return;
wolffd@0 141 end
wolffd@0 142 end
wolffd@0 143
wolffd@0 144
wolffd@0 145 if ~scalararg1
wolffd@0 146 out1 = arg1;
wolffd@0 147 end
wolffd@0 148 if ~scalararg2
wolffd@0 149 out2 = arg2;
wolffd@0 150 end
wolffd@0 151 if ~scalararg3
wolffd@0 152 out3 = arg3;
wolffd@0 153 end
wolffd@0 154 if ~scalararg4
wolffd@0 155 out4 = arg4;
wolffd@0 156 end
wolffd@0 157
wolffd@0 158 rows = max([r1 r2 r3 r4]);
wolffd@0 159 columns = max([c1 c2 c3 c4]);
wolffd@0 160 if scalararg1
wolffd@0 161 out1 = arg1(ones(rows,1),ones(columns,1));
wolffd@0 162 end
wolffd@0 163 if scalararg2
wolffd@0 164 out2 = arg2(ones(rows,1),ones(columns,1));
wolffd@0 165 end
wolffd@0 166 if scalararg3
wolffd@0 167 out3 = arg3(ones(rows,1),ones(columns,1));
wolffd@0 168 end
wolffd@0 169 if scalararg4
wolffd@0 170 out4 = arg4(ones(rows,1),ones(columns,1));
wolffd@0 171 end
wolffd@0 172 end
wolffd@0 173