Split 132*63 by 2 or 3 for avoid complication
Show older comments
Hi Everyone, I have a matrix sized by 132x63. I want to split it in 2 ratio. EX: imagine my matrix is 6x4.
A= [5 7 8 6 6 4, 5 4 7 9 4 2, 9 9 7 5 3 3, 6 4 3 7 3 3]
I want to create new matrix which have columns 1st 3rd 4th 6th of A. Rows 1st and 3rd. new matrix should be 3x2. For my orginal matrixi 132*63, new matrix should be 66*32. How can I split it. Thanks a lot.
Yaman
Answers (2)
Azzi Abdelmalek
on 2 Nov 2012
Edited: Azzi Abdelmalek
on 2 Nov 2012
A= [5 7 8 6 6 4; 5 4 7 9 4 2; 9 9 7 5 3 3; 6 4 3 7 3 3];
B=A([1 3],[1 3 4 6])
for your second example, you did'nt explain how should be your index
A=rand(132,63)
idx1=1:2:131
idx2=[1 3 4 6:2:63]
B=A(idx1,idx2)
Andrei Bobrov
on 2 Nov 2012
A = randi(125,132,63);
B = A(1:2:end,1:2:end);
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!