- Import data (e.g. right click file -> Import data... -> generate code)
- Use scattered interpolant: Interpolating Scattered Data - MATLAB & Simulink (mathworks.com)

# Finding data on specific point from large set data

6 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

AndresVar
on 9 Mar 2022

Edited: AndresVar
on 9 Mar 2022

clear;

%%% get XYZ locations to interpolate

opts = delimitedTextImportOptions("NumVariables", 3);

opts.DataLines = [1, Inf];

opts.Delimiter = ",";

opts.VariableNames = ["VarName1", "VarName2", "VarName3"];

opts.VariableTypes = ["double", "double", "double"];

opts.ExtraColumnsRule = "ignore";

opts.EmptyLineRule = "read";

data = readtable("DATA.csv", opts);

XYZq = table2array(data);

%%% import data from a Theta file

clearvars opts;

opts = delimitedTextImportOptions("NumVariables", 4);

opts.DataLines = [10, Inf];

opts.Delimiter = ",";

opts.VariableNames = ["X", "Y", "Z", "TKThetha1"];

opts.VariableTypes = ["double", "double", "double", "double"];

opts.ExtraColumnsRule = "ignore";

opts.EmptyLineRule = "read";

data = readtable("1.csv", opts);

data = table2array(data);

% create a scattered interpolant object

T_data = scatteredInterpolant(data(:,1:3),data(:,4));

% interpolate the values

T_interp = T_data(XYZq)

### More Answers (1)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!