所以我有这个可爱漂亮的功能需要两个输入:价格向量和日期向量:
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
所以我在想,有没有办法在两个向量的每一个上运行一个函数(迭代)?或者我应该将我的两个向量分成几部分并在每个部分上运行该功能?
提前谢谢大家