Array dimensions must match for binary array op.

I have two groups of images (patients and control subjects) and I am try to perform a two sample t-test but I keep getting this error ''Array dimensions must match for binary array op.'' even though I checked the dimensions of all my images are they are the same (x=46, y=55, and z=46) and their sizes to are the same (voxel size= 3 x 3 x 3). Please I really need help to solve this problem. I am confused as to what array dimensions they are talking about.
Error in y_GroupAnalysis_Image (line 60)
MaskData = any(DependentVolume,4) .* MaskData; % skip the voxels with all zeros
Error in y_TTest2_Image (line 84)
[b_OLS_brain, t_OLS_brain, TTest2_T, r_OLS_brain, Header] =
y_GroupAnalysis_Image(DependentVolume,Regressors,OutputName,MaskFile,CovariateVolume,Contrast,'T',0,Header);
Error in DPABI_STAT_TOOL>ComputeButton_Callback (line 521)
y_TTest2_Image(S, OutputName, MaskFile, ImageCell, TextCell, PALMSettings);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in DPABI_STAT_TOOL (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DPABI_STAT_TOOL('ComputeButton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

3 Comments

Error in y_GroupAnalysis_Image (line 60)
MaskData = any(DependentVolume,4) .* MaskData; % skip the voxels with all zeros
what is initial value of MaskData?
put a break point on this line and see the size of any(DependentVolume,4) and MaskData
MaskData = any(DependentVolume,4) .* MaskData;
The error message indicates that the problem is in this line. Can you be sure that the result of any(DependentVolume,4) has the same number of elements as MaskData?
Thank you all. I just realized that the dimension of the mask file I used is different from the dimension of the images.

Sign in to comment.

Answers (0)

Asked:

on 17 Apr 2020

Commented:

on 17 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!