所以我有这个可爱的漂亮函数,它需要两个输入:价格向量和日期向量:
function [tsve, timeint, dbin,adjtsve, stringdate,rvavg,rv ] = TSVE( price,datetime )
现在我有涵盖很长一段时间的向量价格和日期时间,比如说 20 天,我想计算每天的前一个函数。每天的观察次数是随机的,但我可以轻松找到当天的最后一次观察。
date=floor(datetime);
[a, b, c]=unique(date,'legacy'); <----This gives me the index for the last obs of the day
[~, nbin]=histc(date,a,1); <----I was thinking about accumarray so I made this, but I am not sure I can use it on 2 values simultaneously
所以我在想,有没有办法在两个向量的每一部分上运行一个函数(迭代地)?或者我应该把我的两个向量分成几块并在每一块上运行函数?
谢谢大家