How can i call up a function in app designer?

15 visualizaciones (últimos 30 días)
Kamil Tomiak
Kamil Tomiak el 5 de Dic. de 2017
Respondida: Melissa Williams el 24 de En. de 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
%

Respuesta aceptada

Melissa Williams
Melissa Williams el 24 de En. de 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);

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by