Filter löschen
Filter löschen

Delete a plane (2d) within a 3d matrix

4 Ansichten (letzte 30 Tage)
Zehra Ese
Zehra Ese am 3 Mai 2023
Bearbeitet: John D'Errico am 3 Mai 2023
Hi, I have a 3D matrix with a size of 256x256x256. I would like to delte the first plane (so in 2D) seen from the top, the bottom, from left and from right. How can I compute this using matlab?
  1 Kommentar
Zehra Ese
Zehra Ese am 3 Mai 2023
So at the end I should have a matrix size of 254x254x254.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

John D'Errico
John D'Errico am 3 Mai 2023
Bearbeitet: John D'Errico am 3 Mai 2023
Sometimes it is simpler to take what you want, than it is to delete what you don't want. Here is a matrix:
A = rand(256,256,256);
Clearly you know the size.
B = A(2:255,2:255,2:255);
Which elements are no longer present in B compared to A? If you don't want to create a new matrix, then just assign the result back into the variable A.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by