Splitting Column into Several Columns in Matlab

Hello I'm in an extremely tight spot here as the problem is fairly simply but, for some reason, I've been working on it for a significant amount of time. the premise is pretty simple. I have a large matrix with n amount of rows and several columns. I need to make a new matrix by taking all the values from a fifth column and splitting them in a way that every 180 rows I would start a new column.
Thanks

Answers (1)

Stephen23
Stephen23 on 22 Feb 2018
Edited: Stephen23 on 22 Feb 2018
Where M is your matrix, and assuming that the number of rows of M is divisible by 180:
reshape(M(:,5),180,[])
If the number of rows of M is not divisible by 180 then you need to decide what you want to do with the "tail": pad it with values, remove it, or ...?

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Tags

Asked:

on 22 Feb 2018

Edited:

on 22 Feb 2018

Community Treasure Hunt

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

Start Hunting!