# MATLAB: How to interpolate from a table using an input value

interpolationMATLABmatlab functiontable

``%Number of BladesB = 3;        %Relative VelocityU = 10; %m/srho = 1.2754; % kg/m^3a = (1/3); ar = (1-3*a)/(4*a-1);om = 11/60; %rps%Wind Velocity at the rotorVw = U*(1-a);%% Read csv filesfilename = 'DBAeroprop.csv'filename2 = 'AirfoilData.csv'A = readtable(filename);A.Properties.VariableNames = {'Node' 'RNodes' 'AeroTwst' 'DRNodes' 'Chord'};B = readtable(filename2);B.Properties.VariableNames = {'Angle' 'Cl' 'Cd'}%% Finding Torquedr = 1;r = [0:dr:100];Q=0; %initializationfor i=1:length(r)%     velocity    v = om*2*pi*r(i);%     Circuferential velocity    Vr = v*r(i)*(1+ar);%     chord    c = interp1(A.RNodes, A.Chord, r(i));%     phi angle    phi = atan((U*(1-a)) / (v*r(i)*(1+ar)));%     Twist angle     theta = interp1(A.RNodes, A.AeroTwst, r(i));%     Angle of attack    alpha = phi - theta;%     Cl and Cd (start assuming Cl and Cd fixed then you have to find the way to define Cl and Cd as function of alpha using the tables)    Cl = find_cl(alpha);    Cd = find_cd(alpha);%     Relative velocity    Ur = sqrt(Vr^2 + Vw^2);%     Torque    dQ = B*(1/2)*rho*Ur^2*(Cl*sin(phi)-Cd*cos(phi))*c(i)*r(i)*dr;    Q = Q+dQ;end%% Finding Cd and Cl based on the angle alphafunction Cl = find_cl(x)    Cl = interp1(B.Angle, B.Cl, x)end function Cd = find_cd(x)    Cd = interp1(B.Angle, B.Cd, x)end ``
I believe I am either misusing the interpolation function or have something confused when utilizing it in a for loop. My error reads:
Unable to resolve the name B.Angle.
Error in BET_review>find_cl (line 56)
Cl = interp1(B.Angle, B.Cl, x)
Error in BET_review (line 45)
Cl = find_cl(alpha);
But I don't see any utilization of the interpolation function working. Any help appreciated. Thanks!

``function testtabXYZ = sortrows(randi(99, 10, 3), 1);B = array2table(XYZ, 'VariableNames', {'Angle' 'Cl' 'Cd'});x = 3.8;pqr = find_cl(x);disp(pqr)function Cl = find_cl(x)   Cl = interp1(B.Angle, B.Cl, x, 'linear', 'extrap');endend``