Clear Filters
Clear Filters

Taking 1d and 2d values from structure then interpolate

3 views (last 30 days)
Hi, i have to create a code from 2 structure arrays and the code must first check if my data is 1 dimensional or 2 dimensional. From there it must check if the values of my variables are the same and store them in interpolated. For example, if i have 2 structures a and b and my data is 2d because i have 2 variables deBF and alpha. my code must first compare the values of alpha in a with those in b, if there is a common value i store it in matrix interpolated (interpolated = 40 in this case). secondly i compare deBF values in a with those in b, if there is no common value i must interpolate between 2 values and get the value (since deBF is 6 in a i must interpolate between 5 and 10 in b). Please help
b =
struct with fields:
deBF: [-11.7 -5 0 5 10 16.3 22.5]
alpha: [-10 -5 0 5 10 15 20 25 30 35 40 45 50]
CmBodyFlap: [7x13 double]
a =
struct with fields:
alpha: 40
Mach: 5
deBF: 6
deSB: 0
deA: 0

Answers (1)

Gaurav Garg
Gaurav Garg on 9 Jun 2020
Hey Willibes
You can run a loop and check if the values of deBF in a compare with those in b, and store them in the resultant array.
The same can be repeated for alpha as well.


Find more on Interpolation 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!