Display outputs of Program in AppDesigner

4 views (last 30 days)
Mert Gurer
Mert Gurer on 4 Oct 2021
Answered: Shanmukha Voggu on 27 Oct 2021
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.
Thank you.

Answers (1)

Shanmukha Voggu
Shanmukha Voggu on 27 Oct 2021
Hi Mert,
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
function startupFcn(app)
[output,output2,gg] = main2();%call to main2 function that must be in MATLAB path
%dynamically creating the EditFields in every iteration of the
%below loops
for i=1:length(output)
%updating position of the EditField according to the
%iteration and value is set according to the array contents
for i=1:length(output2)
for i=1:length(gg)
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.


Community Treasure Hunt

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

Start Hunting!