Get Version number of MATLAB app

72 vues (au cours des 30 derniers jours)
Govind
Govind le 29 Oct 2024 à 13:03
Commenté : dpb le 6 Nov 2024 à 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.

Réponse acceptée

dpb
dpb le 29 Oct 2024 à 16:21
Modifié(e) : dpb le 29 Oct 2024 à 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 commentaires
Govind
Govind le 6 Nov 2024 à 12:11
Yes I am using version 2024. And yes both worked. First I changed it to 5.0 to see if it works and by using readlines I do get the version 5.0 and then for the program i changed it 1.0.0 and i get that one as well.
dpb
dpb le 6 Nov 2024 à 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.

Connectez-vous pour commenter.

Plus de réponses (1)

Subhajyoti
Subhajyoti le 29 Oct 2024 à 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:

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