I have matrix A
of size 3 x 100 x 19
.
A(3x100x1) =
Columns 1 through 4
0.0080 0.0090 0.0100 0.0110
0.1350 0.1350 0.1350 0.1350
1.7564 1.7564 1.7564 1.7582
Columns 5 through 8
0.0120 0.0130 0.0140 0
0.1350 0.1350 0.1350 0
1.7599 1.7599 1.7655 0 .... columns 100
A(3x100x2) =
Columns 5 through 8
0 0 0 0.0150
0 0 0 0.1350
0 0 0 1.7599... and so on till 100 column
Similarly till A(3x100x19)
I want to delete empty columns of 3D matrices and need A(3x10x1)
, A(3x10x2)
an so on without empty columns.
I tried
A(:,all(A == 0),:) = [] % it did not work.
I also tried
for m = 1:19
B = A(:,:,segId)
B(:,all(A == 0),:) = [];
end %% It did not work.
Can anyone help me with this?