"someone" wrote in message <email@example.com>... > "Marinela Finta" wrote in message <firstname.lastname@example.org>... > > I am just starting to learn matlab and I would appreciate very much if you could help me... > > > > I am stuck with calculating the returns between some hours and for each day.. > > For some date was going ok the following method: > > (now the price is between that hours) > > n=length(price); > > % The number if days > > %(79 is the number of observations within one day) > > ndays = n/79; > > price_d = reshape(price,79,ndays); > > %I take returns for each day > > returns_d = log(price_d(2:79,:))- log(price_d(1:78,:)); > > > > However now I have another data where the number of observations are not anymore the same for each day..So in one day I have 79 in another 30,75 observations within a day.Therfore i CANNOT use anymore RESHAPE..:( > > I'm not sure why you can't use RESHAPE. > What happens if you make 79 a variable and then > change it to 30, 75, or whatever based on how you > know that the number of observations change. > (Same for 78 in your above code.) > > Also, it seems to me that you should do some error checking > to ensure that ndays is an integer (due to floating point arthmetic). > > > > > How should I do in order to have sorted the observations(prices) according to each day? So to have similar thing as before: row with the prices and column with prices corresponding to each day.. > > thank you for your time.. > > Marinela > >
That is my problem..Because I don't know when the observations within a day are not the same..For using RESHAPE the ndays must be integer.. I cannot look over 900,000rows(dates and prices) for each day to see if there are 79 observations or less.
That way I want something to take me for each day only the prices coressponding to that day..