Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.

Commit fddee34

Browse files
committed
Update CalcGamma.m
Made size and data arrays compatible even if transposed
1 parent 61accc4 commit fddee34

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

CalcGamma.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
% Check if the reference structure contains width, start, and data fields,
103103
% and if the size of the width and start vectors are equal
104104
if ~isfield(varargin{1}, 'width') || ~isfield(varargin{1}, 'start') || ...
105-
~isfield(varargin{1}, 'data') || ~isequal(size(varargin{1}.width), ...
106-
size(varargin{1}.start))
105+
~isfield(varargin{1}, 'data') || ~isequal(length(varargin{1}.width), ...
106+
length(varargin{1}.start))
107107

108108
% If not, throw an error and stop execution
109109
if exist('Event', 'file') == 2
@@ -117,8 +117,8 @@
117117
% Check if the target structure contains width, start, and data fields,
118118
% and if the size of the width and start vectors are equal
119119
elseif ~isfield(varargin{2}, 'width') || ~isfield(varargin{2}, 'start') || ...
120-
~isfield(varargin{2}, 'data') || ~isequal(size(varargin{2}.width), ...
121-
size(varargin{2}.start))
120+
~isfield(varargin{2}, 'data') || ~isequal(length(varargin{2}.width), ...
121+
length(varargin{2}.start))
122122

123123
% If not, throw an error and stop execution
124124
if exist('Event', 'file') == 2
@@ -254,7 +254,7 @@
254254

255255
%% Compute mesh grids
256256
% If the reference dataset is 1-D
257-
if size(varargin{1}.width,2) == 1
257+
if length(varargin{1}.width) == 1
258258

259259
% Log event
260260
if exist('Event', 'file') == 2
@@ -273,7 +273,7 @@
273273
+ varargin{1}.width(1) * (size(varargin{1}.data,2) - 1));
274274

275275
% Otherwise, if the reference dataset is 2-D
276-
elseif size(varargin{1}.width,2) == 2
276+
elseif length(varargin{1}.width) == 2
277277

278278
% Log event
279279
if exist('Event', 'file') == 2
@@ -289,7 +289,7 @@
289289
* (size(varargin{1}.data,1) - 1)));
290290

291291
% Otherwise, if the reference dataset is 3-D
292-
elseif size(varargin{1}.width,2) == 3
292+
elseif length(varargin{1}.width) == 3
293293

294294
% Log event
295295
if exist('Event', 'file') == 2
@@ -319,7 +319,7 @@
319319
end
320320

321321
% If the target dataset is 1-D
322-
if size(varargin{2}.width,2) == 1
322+
if length(varargin{2}.width) == 1
323323

324324
% Log event
325325
if exist('Event', 'file') == 2
@@ -338,7 +338,7 @@
338338
+ varargin{2}.width(1) * (size(varargin{2}.data,2) - 1));
339339

340340
% Otherwise, if the target dataset is 2-D
341-
elseif size(varargin{2}.width,2) == 2
341+
elseif length(varargin{2}.width) == 2
342342

343343
% Log event
344344
if exist('Event', 'file') == 2
@@ -354,7 +354,7 @@
354354
* (size(varargin{2}.data,1) - 1)));
355355

356356
% Otherwise, if the target dataset is 3-D
357-
elseif size(varargin{2}.width,2) == 3
357+
elseif length(varargin{2}.width) == 3
358358

359359
% Log event
360360
if exist('Event', 'file') == 2
@@ -428,7 +428,7 @@
428428
k = 0;
429429

430430
% If the data contains a second dimension
431-
if size(varargin{1}.width,2) > 1
431+
if length(varargin{1}.width) > 1
432432

433433
% Start a for loop to interpolate the dose array along the
434434
% y-direction. Note to support parfor loops indices must be
@@ -445,7 +445,7 @@
445445
k = 0;
446446

447447
% If the data contains a third dimension
448-
if size(varargin{1}.width, 2) > 2
448+
if length(varargin{1}.width) > 2
449449

450450
% Start a for loop to interpolate the dose array along
451451
% the z-direction. Note to support parfor loops
@@ -542,7 +542,7 @@
542542
k = 0;
543543

544544
% If the data contains a second dimension
545-
if size(varargin{1}.width, 2) > 1
545+
if length(varargin{1}.width) > 1
546546

547547
% Start a for loop to interpolate the dose array along the
548548
% y-direction. Note to support parfor loops indices must be
@@ -559,7 +559,7 @@
559559
k = 0;
560560

561561
% If the data contains a third dimension
562-
if size(varargin{1}.width, 2) > 2
562+
if length(varargin{1}.width) > 2
563563

564564
% Start a for loop to interpolate the dose array along
565565
% the z-direction. Note to support parfor loops

0 commit comments

Comments
 (0)