Get Version number of MATLAB app

13 visualizaciones (últimos 30 días)
Govind
Govind el 29 de Oct. de 2024
Comentada: dpb el 6 de Nov. de 2024
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.

Respuesta aceptada

dpb
dpb el 29 de Oct. de 2024
Editada: dpb el 29 de Oct. de 2024
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 comentarios
Govind
Govind el 6 de Nov. de 2024
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 el 6 de Nov. de 2024
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.

Iniciar sesión para comentar.

Más respuestas (1)

Subhajyoti
Subhajyoti el 29 de Oct. de 2024
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:

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by