How do I find values in a matrix which are closest to an integer which is the product of a given value?

3 ビュー (過去 30 日間)
I have a huge data file with time in seconds in column two which has been modified to delete all time values where the x or y coordinates (in column 3 and 4) are 0. This gives me a new data set where the time intervals are not all equal. From this data set I need to be able to find the values that have a 10 second interval and from there plot it against speed. If I had been able to use my original data set I could have found all values which are a product of 10 with no remainder but in this case it may be that I have deleted the integer values from the data set and consequently I would then end up with a 20 sec interval instead. I hope the problem is clearly explained. Does anyone have any idea how to solve this?

採用された回答

Matt Kindig
Matt Kindig 2013 年 10 月 2 日
編集済み: Matt Kindig 2013 年 10 月 2 日
I think I get what you are trying to do. I think the easiest way might be to use interpolation to fill in the missing values, as multiples of 10. Something like this could work:
%time, x, and y are your current data
timei = 0:10:time(end); %interpolated time
xyi = interp1( time, [x(:),y(:)], timei, 'nearest'); %nearest-neighbor interpolation for data
%xyi is your data at 10-second intervals.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by