Loading data from UIAxes to the appdesigner code
Afficher commentaires plus anciens
I am trying to create an appdesigner. Firstly, one can select the .mat file from computer by pushing a button. The selected Figure is shown on UIAxes. Secondly, I want to use data of the selected .mat file when the second button is pushed.
I did the first part, but I could not load the .mat file in the second part of the code.
I wrote the following in the first part:
function SquareButtonPushed(app, event)
load('squareImage.mat')
M = squareImage;
imagesc(app.Ax1,squareImage)
end
For the second part:
function BackProjectionButtonPushed(app, event)
load('app.Ax1')
M = app.Ax1;
However,
Error using load
Unable to read file 'app.Ax1'. No such file or directory.
How can I load the data of app.Ax1 to M?
Réponses (1)
Cris LaPierre
le 26 Déc 2019
Modifié(e) : Cris LaPierre
le 26 Déc 2019
app.Ax1 is a handle to the figure, not a mat file that can be loaded.
If you know what variables exist in the mat file, you can add them as properties to the app, making them available via the app structure.
For example, create a property M, and in the first function, modify the code to be
app.M = squareImage;
Then in the second function because you are already passing in app as an input, you can access the variable using dot notation: app.M
Catégories
En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!