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.
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
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Contact your local office