Use a external function in app designer and display the result in a gauge or Edit Numeric Field using live data as inputs of the function

7 views (last 30 days)
I am trying to use an external function (please, see 'subcooling.m' file) that I created which can provide me the subcooling of a P-H diagram in my model. This function needs two inputs: p2 (pressure in sensor 2) and t3 (temperature in sensor 3) .I tested the code in matlab setting predefines values for p2 and t3 and it worked perfect. But now, I want to use such function in the dashboard that I created in app designer using live data for p2 and t3 provided by my simulink model during the simulation, in order to display such value of the subcooling in an Edit Numeric field or a Gauge. The values of p2 and t3 are displayed in another Edit Numeric Field in the dashboard, for that reason I define p2 and t3 in the code as "app.nameofthenumericfield.Value" (please see the image with the part of the app designer code used to calculate and display the subcooling).
However, when I call the function in app deginer and then run the simulink model, it displays me a complete unexpected value and it does not change during the simulation. So I do not know if I am calling incorrectly the function in my app designer code, or there is something wrong with my function (which is working perfect when I test it in matlab) or there is another thing that I am not taking into account.
I will really appreciate your comments!!!
Thanks in advance,

Answers (0)


Find more on Get Started with Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!