Get Version number of MATLAB app
70 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Govind
am 29 Okt. 2024 um 13:03
Kommentiert: dpb
am 6 Nov. 2024 um 13:16
I have a MATLAB app that I created and we dont have compiler license and so is not a standalone application. I need the version information of this app. I tried googling for solution and I found these online.
and neither of them works. So does anyone know how to access it. Thank you.
0 Kommentare
Akzeptierte Antwort
dpb
am 29 Okt. 2024 um 16:21
Bearbeitet: dpb
am 29 Okt. 2024 um 22:07
AFAICT, the only version saved in the .PRJ files is the app designer toolset version -- which, so far (through R2022b) has always returned "1.0" and this is the number shown in the GUI version field when building a new compiled version; the prior version from previous build even if set to some other value is lost and even in the same session, the next time the build menu is open the prior value is lost. Extremely annoying; particularly since has been brought to TMW's attention several years ago and nothing has changed.
It appears the only place that version is saved is in the compiled code so if you don't compile, it is lost and irretrievable because it simply isn't saved where it is accessible...
From a local app project file here...
>> P=readlines('BuildFoundSheetApp.prj');
>> P(contains(P,{'vers'},'IgnoreCase',1))
ans =
5×1 string array
"<deployment-project plugin="plugin.apptool" plugin-version="1.0">"
" <param.version>1.0</param.version>"
" <param.products.version />"
" <param.version />"
" <param.products.version />"
>>
The .prj files are xml, I just read the text instead of parsing for this posting.
The .mlapp files are compressed, not text, so even if it is in there somewhere (and it may well not be/probably isn't?) it isn't discoverable.
This is, agreed, most annoying behavior...having to reset the version every time one recompiles is a real pit(proverbial)a(ppendage)™
6 Kommentare
dpb
am 6 Nov. 2024 um 13:16
Ah, so! An improvement by Mathworks, indeed, then! Kewl, and thanks for the clarification. I'll recall that for future responses and be pleased when (and presuming) I ever do get to the point with IT at the local community college about updgrading.
You could make a cleaner/neater version probably by using the supplied xmlread function, but I've not ever had the need so don't have any specific experience using it.
Weitere Antworten (1)
Subhajyoti
am 29 Okt. 2024 um 16:00
It is my understanding that you are trying to fetch your project properties (such as, app-version).
To access the application properties without the compiler license, you can add the required properties as a “Access = public, Constant” Property, and access them wherever required.
Here, in the following implementation, I have added the properties for easy access.
properties (Access = public, Constant)
VERSION = "1.5.6.789" % Description
end
Now, you can access this property from any MATLAB Script or command line as follows:
version = sampleApp.VERSION;
Additionally, you can refer to the following resources to know more about sharing data in MATLAB App Designer Applications:
0 Kommentare
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!