Load (file.m) into button pushed function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm beginner in Matlab, I'm designing an app via 'App Designer'. I have a function called 'langmuir.m', I wanted this function to be performed inside button pushed function alongside other calculus. Please help me! My Langmuir.m function as follows:
function output = Langmuir(a,y, x)
n=a(1).*a(2).*y./(1.+(a(2).*y));
output = sum((x-n).^2);
end
And my code for the button pushed function in GUI is as follows:
% Button pushed function: LangmuirButton
function LangmuirButtonPushed(app, event)
x=[1,2,3,4]
y=[5,6,7,8]
load('Langmuir.m')
a = [4 0.7];
SSE = Langmuir(a,y, x);
fminsearch(@langmuir,a,[],x, y);
fun=@(x)ans(1).*ans(2).*x./(1.+(ans(2).*x))
fplot(app.UIAxes,fun,[0,130])
hold
plot(app.UIAxes,x,y,'ob')
It is not loading Langmuir.m and says 'Error using load Number of columns on line 2 of ASCII file Langmuir.m must be the same as previous lines.' What can I do?
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!