how can I define a global variable in app designer?
109 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matteo Paolucci
am 16 Aug. 2020
Bearbeitet: Stephen23
am 2 Sep. 2024
I have to built an app that read data in .csv file and then display and process them.
[file,path] = uigetfile;
tab=readtable(fullfile(path,file));
I used this code for import and save the data but I don't know how can I set them as 'Global variables'.
Can someone help me ?
4 Kommentare
Akzeptierte Antwort
Adam Danz
am 16 Aug. 2020
Bearbeitet: Adam Danz
am 4 Okt. 2020
There are very few reasons, if any, to use global variables in apps and it's usually the sign of trouble.
If the variable is meant to be shared with other functions within the app, declare it as a private variable. If the variable is also needed by external functions or scripts, declare it as a public variable. The link below shows how to do both.
4 Kommentare
Chikezie Onyema
am 2 Sep. 2024
How about loading a very large mat file each time I run app in app designer? How can you not spend minutes loading a file if you have to run the program each time during coding and testing?
Stephen23
am 2 Sep. 2024
Bearbeitet: Stephen23
am 2 Sep. 2024
"How can you not spend minutes loading a file if you have to run the program each time during coding and testing?"
Some approaches:
- Import the data beforehand and supply the file data when you call the program.
- Store it in memory for next time: https://www.mathworks.com/help/matlab/ref/persistent.html
- Avoid loading it into memory: https://www.mathworks.com/help/matlab/large-files-and-big-data.html
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!