How can i call up a function in app designer?
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Kamil Tomiak
le 5 Déc 2017
Réponse apportée : Melissa Williams
le 24 Jan 2018
Right now i have some functions that are in different matlab file but my app designer uses them because they are in the same folder. I copied them into the tap of code browser "functions" and i can see them on my screen. Is it possible to use my functions in app designer without additional files with those function? if yes how do i call up? I uploaded code with my functions in the function code browser
%Funkcja do obliczania azymutu w radianach
function arctan = arctan(app, licznik, mianownik )
if true
% code
wartość arctg z wartoścli bezwzględnej licznik/mianownik
arctg = atan(abs(licznik/mianownik));
if licznik == 0
arctan = 0;
else
if licznik>0 && mianownik>0
arctan = arctg;
else
if licznik>0 && mianownik<0
arctan = pi - arctg;
else
if licznik<0 && mianownik<0
arctan = pi + arctg;
else
arctan = 2*pi - arctg;
end
end
end
end
end
end
And here it is how i use it:
AW1W2 = arctan(dyW1W2,dxW1W2);
AW2W3 = arctan(dyW2W3,dxW2W3);
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167262/image.jpeg)
%
0 commentaires
Réponse acceptée
Melissa Williams
le 24 Jan 2018
If I understand your question correctly, you want to have all your code in the app, without the need for separate files? Yes this is possible in app designer. From the code you pasted, the only thing you are missing is when you call your function, include app as the first argument, like this:
AW1W2 = arctan( app, dyW1W2,dxW1W2);
0 commentaires
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!