Create one matrix of different sized vectors
Show older comments
I have 10 different vectors containing time series data. All have different start dates corresponding to their first row and a different end date corresponding to their last row. How can I combine them into one large matrix with the full time line as the first vector and then the other vectors dropped in at their respective places in the time line with NaNs for the cells that have no data for that series in them? Thanks!
Answers (2)
Sean de Wolski
on 21 Dec 2011
data = nan(max_vector_length,10);
for ii = 1:10
data(1:size(pieceii),ii) = pieceii; %pseudoish code
end
How you have your vectors stored greatly affects how you insert them. Refer to this document:
2 Comments
Rebecca
on 21 Dec 2011
Sean de Wolski
on 21 Dec 2011
Ok. I think I completely misunderstood your question.. Could you edit your original question to include a small set of sample data (perhaps two vectors 5-10 elements long) the operation and the expected results.
Rebecca
on 21 Dec 2011
Categories
Find more on Logical 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!