How can i call up a function in app designer?
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File 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!