For Loop for storing data

1 visualización (últimos 30 días)
Zach Wallace
Zach Wallace el 12 de Nov. de 2016
Editada: James Tursa el 12 de Nov. de 2016
How would I write a for loop to extract columns from a large matrix and put it into a new matrix. For example, I want to take every 6th column of my very large matrix and store it in a new matrix.
Thanks!

Respuestas (1)

James Tursa
James Tursa el 12 de Nov. de 2016
Editada: James Tursa el 12 de Nov. de 2016
No loop needed:
a = your very large matrix
b = a(:,1:6:end); % every 6th column, starting with 1st column

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by