Multiple App Designer Compiler

7 vues (au cours des 30 derniers jours)
Alejandro Luque
Alejandro Luque le 29 Juin 2020
Modifié(e) : Riya le 22 Août 2025
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?

Réponses (1)

Riya
Riya le 18 Juin 2025
Modifié(e) : Riya le 22 Août 2025
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:

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by