MATLAB: Assign null to rows of a matrix

a null assignment can have only one non-colon indexMATLAB

Hi guys,
I wanted to assign increment rows of null to a variable "C". The variable C has a size of 138x6x69. My code is shown below.
a = 1;
for i = 1:69
C(1:a,:,i)=[];
a = a+2;
end
But the error was " A null assignment can have only one non-colon index.A null assignment can have only one non-colon index."
Can anyone teach me another way of modifying the code? I really need help.
Much Thanks
Ben

Best Answer

You cannot assign 'null' like this to a 3D matrix while wanting to maintain the dimensions of the matrix. You can assign zero or NaN depending on what you want to achieve here.