Display outputs of Program in AppDesigner
3 views (last 30 days)
I have a main Program "main2" for some calculation.
The results of this Program are three arrays:
First array "output" is a 1x4 string
Second array "output2" is a 1x2 double
Third array "gg" is a 1x1 double
I want to display these results in my App in Appdesigner (in different Editfields). E.g. output(1,1) in Editfield1
How can I do this?
My current App is pretty basic and the Callbacks and StartupFunction contain just some tries which are commented out.
Shanmukha Voggu on 27 Oct 2021
The Problem can be solved by two ways as mentioned below:
1) Manually create all the required EditFields in the design view of the app, name them and assign values
% and so on, This can be useful when you have small and fixed size output
% arrays from main2 function
2) If the outputs of the function vary in size dynamically, then the following process is recommended
Let's have an arbitrary main2 function in the same folder where the app is created or in MATLAB Path
function [output,output2,gg] = main2()
% outputs of the function main2
Update the startup function of the app as follows
[output,output2,gg] = main2();%call to main2 function that must be in MATLAB path
%dynamically creating the EditFields in every iteration of the
%updating position of the EditField according to the
%iteration and value is set according to the array contents
The app looks like as follows:
The ideal way to achieve the goal is to use TextArea component for it to reliably display the array.
Refer to this for more information.