How do I call another .m file to run some calculations

4 ビュー (過去 30 日間)
Jonathan Moorman
Jonathan Moorman 2020 年 12 月 18 日
回答済み: Ruger28 2020 年 12 月 18 日
Hi!
I'm using app designer and I need to call another .m file to run some calculations for me. The .m file I will be calling requires two inputs (x and y) and it should send back to outputs (xhat and yhat). Could someone please provide some code on how to do this? Thanks
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 12 月 18 日
Jonathan Moorman
Jonathan Moorman 2020 年 12 月 18 日
Sorry, I'm a bit lost (new to matlab). Could you write out how it should look? Everything I'm trying with the link is still giving an error

サインインしてコメントする。

採用された回答

Ruger28
Ruger28 2020 年 12 月 18 日
In app designer somewhere when you want to call your function, make sure you have your data ready, and the function is on your path (place it in the same folder as your app).
% Some Callbacks and code later, you come up with x & y
%..
%..
x = [1:5]
y = [1:5]
[xhat, yhat] = MyOutsideFunction(x,y)
In a seperate .m file, you have your function, but I'll make a dummy function
function [xhat, yhat] = MyOutsideFunction(x,y)
xhat = x * 100;
yhat = y * 100
end % function end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by