Remove Zeros Matrix on 3D Matrix

17 次查看(过去 30 天)
I have Matrix A twhich is a 3D matrix that contain zeros matrix, How to delete the zeros matrix?
here i attach the example of my matrix.
the result that i want is matrix A should be (2,3,3)

采纳的回答

Matt J
Matt J 2022-1-8
val = val(:,:, any(val,[1,2]) )

更多回答(1 个)

Torsten
Torsten 2022-1-8
编辑:Torsten 2022-1-8
function main
val = rand(2,3,4)
val(:,:,3) = []
end

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by