Sharing Data between Apps (App Desginer)

조회 수: 26 (최근 30일)
MSP
MSP 2018년 5월 19일
답변: Ahmed SAIMI 2019년 3월 16일
Hi,
i am trying to create an App using Appdesigner, which should have more than 1 window. My idea after reading some similar questions was to create a public function and call it from my second app (2 window). When calling this function, a matrix with all information that is needed would be "transferred" to my second app. The same i would do to transfer the data back to the 1 app.
My Function: Name of the 1st App: App1
methods (Access = public)
function SharedData = getData(app)
SharedData = app.App1Data;
end
end
and to call it in the 2 app i tried using: Name of the 2nd App: App2
SharedData = getData(APP1);
app.App2Data = SharedData;
And to open the 2nd App I just used run App2 in the App1 script (after pressing Button) When I analyse my app.App2Data, it is empty an no Data was "transferred".
I know that there is a "Share Data Within App Designer Apps" topic, but i am using Matlab 2017a and that functionallity (ADD Input Arguments) was implementend on Matlab 2017b.
Does anyone knows how to share Data between Apps? or can help me to make it work? Or send me an good example how to do that? i saw some examples but i need something that works and is easy to understand.
Thanks in advance, MP

답변 (2개)

WSS
WSS 2018년 11월 11일
I found this while looking https://www.mathworks.com/help/matlab/creating_guis/creating-multiwindow-apps-in-app-designer.html#mw_b4d7e3b6-7641-40a6-8dd3-148c03c77298

Ahmed SAIMI
Ahmed SAIMI 2019년 3월 16일
greeting,
plz i try to how to share data between two apps in app designer
i folowed the exemples
it dosn't help me in my probleme , i need a simple easy exemple, of sharing TextArea.Value from 1st app to passe it to use it in the seconde app
in the first app code i try to stock the value of app.TextArea.Value and use it in the seconde app
properties (Access = public)
Filepath
end
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
% app.DATAGENUIFigure.Position = [500 400 297 137];
end
% Button pushed function: GeneratRotorDataButton
function GeneratRotorDataButtonPushed(app, event)
[FileName,PathName] = uigetfile('*.mat','Select the Rotor DATA file Path');
file=fullfile(PathName,FileName);
app.TextArea.Value=file;
load (file, 'rotortype')
handles.rotortype=rotortype;
rotortype=handles.rotortype;
app.Filepath=file;
if rotortype==1
ISOTROPDATAGEN
else
end
the seconde app code i need to load a .mat file automatecly without uigetfile window (Filepath is the path of my file to load)
function startupFcn(app)
load(app.DATAGEN.Filepath)
plzzzzzzz help me

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by