How can i call up a function in app designer?

조회 수: 15 (최근 30일)
Kamil Tomiak
Kamil Tomiak 2017년 12월 5일
답변: Melissa Williams 2018년 1월 24일
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
%

채택된 답변

Melissa Williams
Melissa Williams 2018년 1월 24일
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개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by