Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Indexing Values to closest approximation

Subject: Indexing Values to closest approximation

From: David

Date: 26 Sep, 2012 15:40:08

Message: 1 of 2

I have two sets of data. One where the data was collected every 15 minutes (Tension) and one where data was collected approximately every 33 seconds (Weight). The tension readings are exactly every fifteen minutes but the weight readings have variations of a few seconds +/-. The matrices are setup so time is in column 1 and the reading is in column 2. They look like this:
[0 -0.282150000000000
0.250000000000000 -0.336100000000000
0.500000000000000 2.25360000000000
0.750000000000000 2.84710000000000


[0 1295.70000000000
0.00916666700000000 1295.77000000000
0.0183333330000000 1295.77000000000
0.0277777780000000 1295.94000000000
0.0366666670000000 1295.94000000000

I am trying to find a way to associate a single weight value for each tension value. Thus what is the weight at time = 0 , 0.25, 0.5, etc... The problem is there aren't any weight values that are taken at exactly .25, .5, .75, etc... therefore it needs to be the closest value to each time. How would I set up a function to do this. There are 949 tension readings and 26449 weight readings.

Subject: Indexing Values to closest approximation

From: Bruno Luong

Date: 26 Sep, 2012 15:55:08

Message: 2 of 2

You might use INTERP1 with 'NEAREST' option.


Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us