MATLAB: Subscripted assignment dimension mismatch

assignmenterror

Hello, I'm trying to do the following assignment and get an error: "Subscripted assignment dimension mismatch" "masking" is new veriable and this is the first assignment to it. "indx" is as follow: 300x10x2011 logical
masking(:,:,1)=indx;
what is wrong?

Best Answer

You're trying to assign a 3D matrix into a 2D one. Try,
masking(:,:,:,1) = indx;