Filter löschen
Filter löschen

how to load a .mat file in GUI( without guide)?

2 Ansichten (letzte 30 Tage)
Helene Cheung
Helene Cheung am 16 Mär. 2021
Bearbeitet: Helene Cheung am 16 Mär. 2021
I'm writing a GUI without guide or app designer recently.
The question I have is that I don't know how to pass data between different callback functions.
My requirement is load a .mat file in the callback function of one button, and data in this .mat file can be used in other functions.
function btnRtSet_ButtonPushed(hObject,eventdata,handles)
load('Net.mat');
InitNet;
end%btnRtSet_Callback
This function is the callback of a button, and InitNet is a .m file.
Data in Net.mat are as follows,
Link struct
Conn struct
And functions in InitNet are very basic and simple.
Here are warnings after running,
Error using load
Attempt to add "Conn" to a static workspace.
  1 Kommentar
Rik
Rik am 16 Mär. 2021
This is a public forum. If you want people to be able to contact you, you can enable this in your community profile. By asking for responses via email you are effectively asking people to help you, without any possibility of others benefitting from the help as well.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Mär. 2021
function btnRtSet_ButtonPushed(hObject,eventdata,handles)
datastruct = load('Net.mat');
Link = datastruct.Link;
Conn = datastruct.Conn;
InitNet;
end %btnRtSet_Callback

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by