For Loop for storing data

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!

回答(1 个)

James Tursa
James Tursa 2016-11-12
编辑:James Tursa 2016-11-12
No loop needed:
a = your very large matrix
b = a(:,1:6:end); % every 6th column, starting with 1st column

类别

在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by