How to organize large column in to small Commons.
조회 수: 3(최근 30일)
Hello I have a large col vector in matlab with size of ~10000. I would like to cut the col at every 100 point as you see it below separate each col. and save it in separate
a4=[x(301:400)];... and so on.
However doing like this will take forever. Is ther anyway to do it in loop. Any help is appreciated.
Adam Danz 2018년 9월 17일
This requires dynamic variable naming and it's not a good practice. To understand why read this:
Instead, if the length of your vector is a multiple of 100 and your data are numeric, turn your vector into a matrix where each column is your 'a1', 'a2', etc. Here's an example using reshape().
data = rand(10000,1);
dataMat = reshape(data, 100, );
Your variable a12 is just column 12
If your data are not all numeric or the length of your vector is not a multiple of 100, describe your dataset and we can work out a solution using cell arrays.