Excel column operations in Matlab
Show older comments
Hello, I would appreaciate if anybody could share an idea about following problem: I`m working with an excel data sheet where I have two variables in two respectice columns.I can import the data with "uiimport" into Matlab as two column vectors. The clue is now following. The two vectors(columns) with same length depend from eachother, I have a time series with two measurements, column x contains a permanent measurement (each row with number data), column y contains just very few measurements(for example in rows 31, 45, 78, 97) the rest of the rows is recognised by Matlab as NaN. My question is: How can I split the x column vector (with the full data series) by the y vector so that at the row y~=NaN the x vector is divided in subvectors. In other words if I have: x=[1 3 56 12 34 45 67 12 13 12], y=[NaN Nan 1 NaN Nan 5 NaN NaN 10 Nan] x1 should be [1 3 56] x2=[12 34 45] x3=[67 12 13] x4=[12] because by each number element of y will be defined the end of a subvector extracted from x. Thank you in advance.
Answers (1)
Fangjun Jiang
on 9 Aug 2011
0 votes
I believe the solution can be found in this post. http://www.mathworks.com/matlabcentral/answers/12938-parsing-a-vector. It is just using the index to split a different vector with the same length. Also, the split point is non-NaN instead of NaN. Take a look to see if you can figure it out.
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!