Vecorize search for pattern
1 view (last 30 days)
Show older comments
Hello, I am trying to find patterns within longer series of data. So far I have done this in a loop, but I need to search larger matrices. Below is a simple example. I have tried to vectorize but so far without success meaning the code did not really get faster - any idea? Is there a matlab build in function which does that?
Simple example:
o_data=rand(1000,20);
patt= o_data(1:10,:);
for ii=1:size(patt,2)
for i=1:size(o_data,1)-size(patt,1)
close_index(i)=mean(abs(patt(:,ii)-o_data(i:i+size(patt,1)-1,ii)));
end
[vals ix]=sort(close_index);
closest_ten(ii,:)=ix(1:10);
end
0 Comments
Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!