フィルターのクリア

increment high resolution distance data by lower resolution equal steps

1 回表示 (過去 30 日間)
JE
JE 2017 年 4 月 5 日
回答済み: Guillaume 2017 年 4 月 5 日
I have distance data at very high resolution, uneven intervals, and want to reduce the resolution and have equal intervals. I know how to do this in excel vba but i'm having difficulty in figuring out how to do this in Matlab.
In excel vba, my code basically says the following:
% code
Increment value (IV) = 0.045 miles
Start Value (SV) = Active Cell
If active cell value > IV + SV
Then round active cell to nearest 0.05
Next cell until end of column...
end
Essentially, the vba code checks to see if a cell's value is > the point before my incremental value. If it is, it will round this distance point to the nearest 0.05 mile.
What is the best way to go about this code in matlab? Combination of functions? loop?

回答 (2 件)

Star Strider
Star Strider 2017 年 4 月 5 日
I would use the interp1 function, using the linspace function to create the interpolation vector.

Guillaume
Guillaume 2017 年 4 月 5 日
Wouldn't
round(yourvector / desiredstep) * desiredstep
%or
round((yourvector - yourvector(1)) / desiredstep) * desiredstep
produce what you want? E.g.:
v = sort(round(1, 100)) + 1.25; %demo vector in uneven increments from 1.25 to 2.25
round(v / 0.05) * 0.05 %same vector rounded to the nearest 0.05 step.

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by