How to split a column of imported data to multiple columns?
2 views (last 30 days)
Show older comments
Hello Everyone, I am working on data analytics at my college. I am new to MATLAB and i am trying to import some data from excel woorksheet. I have imported the data but i am unable to split the columns into multiple columns. Let's say I have 108000 rows in a column and I want to split it into 216 columns of 500 elements in each column. I have tried "doc reshape" command but I got an error that the number of elements are not matching with the source. This have though I tried to split them into 2 columns of 54000 rows in each. Please help me in resolving this issue. The below is the code I tried.
doc reshape
>> A = BaseFFTPeak(54144,1)
A =
9.3000e-05
>> B = reshape(A, 27072,2)
Error using reshape
| |To RESHAPE the number of elements must not change| | .
>>
0 Comments
Answers (1)
Star Strider
on 5 Jul 2015
This works for me:
Col = randi(99, 108000, 1); % Create Data
Mtx_1 = reshape(Col, 500, []); % To (500 x 216)
Mtx_2 = reshape(Col, 54000, []); % To (54000 x 2)
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!