MATLAB Answers

Faster sliding window statistics?

조회 수: 8(최근 30일)
K E
K E 13 Oct 2016
편집: K E 14 Oct 2016
I use slidefun to estimate statistics such as max, min, or RMS within a sliding window applied to a time series. It is very useful, but it can be slow if there are a lot of data points. Is there a faster sliding window routine out there? I didn't see any obvious candidates in the File Exchange, but would like to know if I missed any.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 13 Oct 2016
If you're using release R2016a or later, consider using the moving statistics functions in MATLAB for at least min and max.
Depending on exactly what type of windows you're using, if you're using release R2016b storing your data in a timetable and using the retime function with an aggregation method is another potential option.

  댓글 수: 1

K E
K E 14 Oct 2016
On my machine: with movmin , 0.7s. With slidefun, 310s. This is really going to streamline a lot of work for me & my coworkers.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Image Analyst
Image Analyst 13 Oct 2016
You can use these alternate functions. For mean, use conv(). For max, use imdilate(). For min use imerode(). Or the new moving stats functions Steve mentioned. They're all highly optimized. Whether they're faster than slidefun() is something you'll just have to check.

  댓글 수: 1

K E
K E 14 Oct 2016
Unfortunately I do not have the Image Processing Toolbox, but I am sure these would be faster.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by