MATLAB: Re-arranging of columns

re-arrange columns

hi everyone..
i have a data file with 24 columns and 125 rows… I want to bring 23rd column after column 4… how will i do that… please help

Best Answer

Once you import this data into a MATLAB variable, there are multiple methods. One way is as follows, where x is the data and y is where I am storing the new data.
y = [x(:,1:4) x(:,23) x(:,5:22) x(:,24)]