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

3 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Matt Kindig
Matt Kindig il 2 Ott 2013
Modificato: Matt Kindig il 2 Ott 2013
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.

Più risposte (0)

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by