Eliminar filas o columnas de una matriz - MATLAB & Simulink - MathWorks América Latina (2024)

Abrir script en vivo

La manera más sencilla de eliminar una fila o una columna de una matriz es igualar dicha fila o columna a un par de corchetes vacíos []. Por ejemplo, cree una matriz de 4 por 4 y elimine la segunda fila.

A = magic(4)
A = 4×4 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1
A = 3×4 16 2 3 13 9 7 6 12 4 14 15 1

Ahora, elimine la tercera columna.

A(:,3) = []
A = 3×3 16 2 13 9 7 12 4 14 1

Puede ampliar este enfoque a cualquier arreglo. Por ejemplo, cree un arreglo aleatorio de 3 por 3 por 3 y elimine todos los elementos de la primera matriz de la tercera dimensión.

B = rand(3,3,3);B(:,:,1) = [];

Temas relacionados

Comando de MATLAB

Ha hecho clic en un enlace que corresponde a este comando de MATLAB:

 

Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.

Eliminar filas o columnas de una matriz- MATLAB & Simulink- MathWorks América Latina (1)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

Europe

Asia Pacific

Contact your local office

Eliminar filas o columnas de una matriz
- MATLAB & Simulink
- MathWorks América Latina (2024)
Top Articles
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 5730

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.