Multiple App Designer Compiler

조회 수: 7 (최근 30일)
Alejandro Luque
Alejandro Luque 2020년 6월 29일
편집: Riya 2025년 8월 22일
I have designed an application with App Designer. It consists of 3 or 4 mlapp files, different matrices and tamblas to obtain data and some function. When I compile the application in a desktop app, the attempt to open the different windows works correctly for me, but when in theory I would have to save some values in the amtriz they don't. What is this about? Do I have to create a realtion for the application to find and save in the folder?

답변 (1개)

Riya
Riya 2025년 6월 18일
편집: Riya 2025년 8월 22일
Hi Alejandro,
I understand that you have developed a desktop application using multiple .mlapp files that interact with each other to process and store data in matrices. While the windows open correctly after compilation, it seems the application fails to save values into the matrices as expected. This behavior is indeed common when working with multiple apps in compiled form.
This issue stems from how data is being shared across your different .mlapp files. When running inside MATLAB, variables can sometimes be accessed more freely. However, in a compiled app, each app instance runs in isolation, and hence does not share variables or workspace data unless this is explicitly handled.
To resolve this, use .mat files for data sharing. To enable reliable data sharing between app windows, consider saving and loading shared data (e.g., matrices) using .mat files stored in a valid directory. Here is an example approach:
In App 1 – Saving Data:
dataMatrix = [1 2 3; 4 5 6];
save(fullfile(tempdir, 'sharedData.mat'), 'dataMatrix');
In App 2 – Loading Data:
if isfile(fullfile(tempdir, 'sharedData.mat'))
loaded = load(fullfile(tempdir, 'sharedData.mat'));
dataMatrix = loaded.dataMatrix;
end
Note that using tempdir ensures that the path is writable even in compiled mode.
For further reference on file operations and data management in compiled applications, you may refer to the following official documentation:

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by