Delete specific periodic rows or columns in matrix

1 view (last 30 days)
Hei! I have a big matrix and I need to delete specific columns. More specifically, I have 2250 columns consisting of 50 subsets of 45 columns. In each subset, I need to keep the first 18 columns, delete columns 19 and 20, keep columns 21 to 45 and so on. In the end i will have deleted 2 columns in every set, so I have 2150 columns in total. Any help would be really appreciated!

Answers (1)

KSSV
KSSV on 17 Nov 2016
Edited: KSSV on 17 Nov 2016
M = rand(2250) ; % random data
idx = [19 20 21 45] ; % columns to delete/ remove
M(:,idx) =[]; % removing those columns

Tags

Community Treasure Hunt

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

Start Hunting!