How can i call up a function in app designer?

10 visualizzazioni (ultimi 30 giorni)
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
%

Risposta accettata

Melissa Williams
Melissa Williams il 24 Gen 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);

Più risposte (0)

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by