Lookup values in other table that has a range of values
Show older comments
I've got two data sets from a drilling project collected by different sensors.
One table has rate of penetration at the recorded depths. The other has wireline gamma values for the same hole but at different recorded depths.
Rate of Penetration data set
holeid = [12;12;12;12;12;12;12;12;12;12;12;12;12;12;12;12];
depth = [0;0.0542;0.0801;0.2222;0.3959;0.4572;0.5110;0.5348;0.5712;0.6099;0.6437;0.6799;0.8011;0.8928;0.9590;1.0110];
rop = [118.7000;207.8000;139.6000;176.0000;177.8000;229.3000;242.4000;138.9000;85.7000;140.8000;164.5000;125.4000;189.8000;164.0000;118.4000;211.4000];
rophole12 = table(holeid,depth,rop);
Gamma data set
(e.g. depth from 0 to 0.13 is treated as from/to range and has gamma value of 1, depth of 0.13 to 0.22 has gamma value of 12, etc)
holeid1 = [12;12;12;12;12;12;12;12;12;12;12;12;12];
depth1 = [0;0.13;0.22;0.36;0.48;0.56;0.67;0.78;0.84;0.96;1.03;1.14;1.24;];
gamma1 = [1;12;34;23;42;12;43;67;111;200;153;188;55];
gammahole12 = table(holeid1,depth1,gamma1);
What's the best way to get the gamma values from gammahole12 at the depths specified in the rophole12 table e.g. gamma at 0, 0.0542, 0.0801, etc?
In excel, I've used the vlookup function with true. Is there a MATLAB equivalent or different way to lookup a value within a different table with approximate reference, e.g. depth in this case?
Accepted Answer
More Answers (1)
Cris LaPierre
on 14 Feb 2022
Edited: Cris LaPierre
on 14 Feb 2022
% Recreate your tables
holeid = [12;12;12;12;12;12;12;12;12;12;12;12;12;12;12;12];
depth = [0;0.0542;0.0801;0.2222;0.3959;0.4572;0.5110;0.5348;0.5712;0.6099;0.6437;0.6799;0.8011;0.8928;0.9590;1.0110];
rop = [118.7000;207.8000;139.6000;176.0000;177.8000;229.3000;242.4000;138.9000;85.7000;140.8000;164.5000;125.4000;189.8000;164.0000;118.4000;211.4000];
rophole12 = table(holeid,depth,rop);
holeid1 = [12;12;12;12;12;12;12;12;12;12;12;12;12];
depth1 = [0;0.13;0.22;0.36;0.48;0.56;0.67;0.78;0.84;0.96;1.03;1.14;1.24;];
gamma1 = [1;12;34;23;42;12;43;67;111;200;153;188;55];
gammahole12 = table(holeid1,depth1,gamma1);
% Use discretize to find the corresponding 'bin' gamma value
rophole12.gamma = discretize(rophole12.depth,[gammahole12.depth1;inf],gammahole12.gamma1)
1 Comment
Daniel Goldstein
on 14 Feb 2022
Categories
Find more on Support Vector Machine Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!