Loading a file into a function error: "Unable to resolve the name __"
Ältere Kommentare anzeigen
I am trying to create a function that uses data from a file named Atmos.mat, however, no matter how I load the file, the function returns the error: "Unable to resolve the name Atmos.mat" Any help would be greatly appreciated :)
function x = rho(point)
load('Atmos.mat')
distance = zeros(1,229);
for k = 1:1:229
distance(k) = abs(point - Atmos.Hm(k));
end
for k = 1:1:229
if (distance(k) == min(distance))
break
end
end
x0 = Atmos.Hm(k);
p = @(x) (x - x0)/(Atmos.Hm(2) - Atmos.Hm(1));
f = @(x) p(x)*(p(x)-1)/2;
interpolation = @(x) Atmos.rhosi(k) + p(x)*(Atmos.rhosi(k + 1) - Atmos.rhosi(k))- f(x)*(Atmos.rhosi(k + 2) -2*Atmos.rhosi(k + 1)+ Atmos.rhosi(k));
x = interpolation(point)
end
2 Kommentare
Jonas
am 2 Jul. 2021
does the error occur in the load() line or in the line you use the variable Atmos first? We don't know if your file Atmos.mat contains the variable Atmos
Michal Amar
am 2 Jul. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Preprocessing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
