Delete rows from matrix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amal
el 4 de Mzo. de 2014
Comentada: Amal
el 4 de Mzo. de 2014
Hallo,I need help!
I have 110 matrix 64 line x 2200 column and I would like to delete some columns from each matrix, so I am obliged to use loops for each matrix. I am looking for a predefined function to delete the columns. This is a small algorithm explaining what I mean:
for i=1:110
delete( matrix(:,j:j+5)) from matrix;
end
2 comentarios
Image Analyst
el 4 de Mzo. de 2014
Editada: Image Analyst
el 4 de Mzo. de 2014
WHY are you obligated to use loops rather than the vectorized method the others suggested? Do you just think you do (because you don't know how to use MATLAB's vectorization capability), or did your professor/instructor mandate it?
Respuesta aceptada
Giorgos Papakonstantinou
el 4 de Mzo. de 2014
Editada: Giorgos Papakonstantinou
el 4 de Mzo. de 2014
IN the title you mention rows. In the question you mention columns. example:
A1=randi(10,64, 2200);
A2=randi(10,64, 2200);
A3=randi(10,64, 2200);
...
An=randi(10,64, 2200);
mat=[A1;A2;A3;...An];
startcolumn=11;
step=11;
mat(:,[startcolumn:step:end])=[]
Más respuestas (1)
Iain
el 4 de Mzo. de 2014
To "delete"
matrix = eye(5);%5x5 identity matrix
list_o_cols_to_delete = [1 3 5];
matrix(:,list_o_cols_to_delete) = []
To only use the bits you want:
matrix = eye(5);%5x5 identity matrix
list_o_cols_to_use = [1 3 5];
used = matrix(:,list_o_cols_to_use)
0 comentarios
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!