From: Sadik on 19 Feb 2010 20:04 Actually you can do it very easily. Please realize that your dates are now unique numbers. 20 million, 90 thousand 102 and so on. The best way would be reading your data into a 2-column matrix, very similar to what you have written [I will call this matrix A]. Then, you should do: uniqueDates = unique(A(:,1)); newMatrix = zeros(length(uniqueDates),100); for dateCounter = 1:length(uniqueDates) indicesOfThisDate = find(A(:,1)==uniqueDates(dateCounter)); dataOfThisDate = A(indicesOfThisDate,2); newMatrix(dateCounter,1:length(dataOfThisDate)) = dataOfThisDate'; end Please watch for typos since I didn't test this in matlab. Best. "Tiina " <creates1(a)gmail.com> wrote in message <hlnb4q$i5c$1(a)fred.mathworks.com>... > > I need to organise a large file of data that appears like > Date obs > 20090102 900 > 20090102 600 > 20090102 800 > 20090102 800 > 20090102 700 > > 20090103 650 > 20090103 900 > 20090103 840 > > 20090104 100 > 20090104 1000 > 20090104 600 > 20090104 450 > > How can I transform the data to look like the following matrix: ( I got 1000s of dates like that and there are different observations for each day with a max of 100 per day but can be less at times so i got to fill the empty observations with zeros) > > 2009-01-02 900 600 800 800 700 > 2009-01-03 650 900 840 0 0 > 2009-01-04 100 1000 600 450 0 > I appreciate any help  > > tiina
|
Pages: 1 Prev: re-arranging data into a matrix Next: Selecting 3d coordinates....kinda like a '3d' ginput |