How to produce a GUI that is almost like a mirror of another GUI.
조회 수: 1(최근 30일)
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).
classdef WEBCAM_FOR_DOCTOR < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
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')
app.cam = webcam;
frame = snapshot(app.cam);
theSpeakerImage = image(app.UIAxes, zeros(size(frame), 'uint8'));
Comment area: using text area and storing it outside matlab.
% Value changed function: DoctorsCommentsTextArea
function DoctorsCommentsTextAreaValueChanged(app, event)
value = app.DoctorsCommentsTextArea.Value;
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.
- assigin: I tried assigning the textarea into workspace using assigin(ws,var,val) but this gives error
- 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.
Pranjal Kaura 2021년 11월 22일
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!