How to produce a GUI that is almost like a mirror of another GUI.

3 views (last 30 days)
hello everyone, as preparation for my internship, I have been practicing matlab (2019 version) and python alternating every 3 days.
During my matlab study, I choose Doctor livestreaming as a project to tackle as it was a final year assignment my seniors did, I have the following AppDesigner code which runs well after going through many materials online (audio is done through simulink).
The Properties:
classdef WEBCAM_FOR_DOCTOR < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup2 matlab.ui.container.TabGroup
Tab matlab.ui.container.Tab
Tab2 matlab.ui.container.Tab
UIAxes matlab.ui.control.UIAxes
VIDSwitch matlab.ui.control.Switch
DateTimeTextAreaLabel matlab.ui.control.Label
DateTimeTextArea matlab.ui.control.TextArea
TabGroup matlab.ui.container.TabGroup
DoctorsCommentsTextAreaLabel matlab.ui.control.Label
DoctorsCommentsTextArea matlab.ui.control.TextArea
Switch matlab.ui.control.Switch
properties (Access = private)
methods (Access = private)
function results = func(app)
methods (Access = public)
function results = func2(app)
The livestreaming: a toggle switch turns the video of UIAxis On or Off with if-statment.
% Value changed function: VIDSwitch
function VIDSwitchValueChanged(app, event)
value = app.VIDSwitch.Value;
if strcmp(value, 'On') = webcam;
frame = snapshot(;
theSpeakerImage = image(app.UIAxes, zeros(size(frame), 'uint8'));
axis(app.UIAxes, 'image');
preview(, theSpeakerImage);
Comment area: using text area and storing it outside matlab.
% Value changed function: DoctorsCommentsTextArea
function DoctorsCommentsTextAreaValueChanged(app, event)
value = app.DoctorsCommentsTextArea.Value;
formatSpec= "%s";
for i = 1:length(value)
I am moving onto python tomorrow which is why I would like to post my question here. I have been trying to have another GUI mirror this one and tried the following methods for textbox as UIAxes would be too difficult to start with.
  1. assigin: I tried assigning the textarea into workspace using assigin(ws,var,val) but this gives error
  2. setappdata: I tried the setappdata and getappdata using global variable inside the app. I tried setting it as setappdata(APPNAME.TextArea,value ) and when that didnt work I tried with app1 and app2 as the names for the apps. I also tried setting the two apps in public property but there is still error
I went through multiwindow but have not used it for this GUI as I want 2 GUIs with none of them being dialog boxes.
I am trying to get two GUIs with one GUI being the main one and the other GUI mirroring the output of the first one.
Is there any way to do so? any help is appreciated and thank you in advance.

Accepted Answer

Pranjal Kaura
Pranjal Kaura on 22 Nov 2021
Hey Garabani,
It's my understanding that you want to share data between 2 apps.
You can do so by calling the apps from the command window and then use app 'properties' to share data. You can refer to this link to know more about sharing data between apps using properties.
The other workaround could be to send app data to the workspace using 'assignin' functionality and then read it in the other app using the 'evalin' function. I have attached 2 app models wherein I've done the same. However, keep in mind that this method can lead to errors or wrong results , if the variables in the workspace are deleted or changed.
Hope this helps!

Sign in to comment.

More Answers (0)


Find more on Migrate GUIDE Apps 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!

Translated by