MATLAB: Hi , i have a matrix and need to extract the column in this way , thank you

MATLABmatrixmatrix arraymatrix manipulation

clear all
clc
A=[ 1:16;17:32;33:48;49:64] ;
% i need to exctract the [ 1 5 9 13 ] column vectro from matrix A and put them in another matrix B with diminsion 4×4
% the rest of the column i need them in another matrix C with dimensione 4×12
% thank you

Best Answer

idx= [ 1 5 9 13 ];
A(:,idx) % 4 X 4
A(:,setdiff(1:size(A,2),idx)) % 4 X 12