Get Version number of MATLAB app

73 views (last 30 days)
Govind
Govind on 29 Oct 2024 at 13:03
Commented: dpb on 6 Nov 2024 at 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.

Accepted Answer

dpb
dpb on 29 Oct 2024 at 16:21
Edited: dpb on 29 Oct 2024 at 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 Comments
Govind
Govind on 6 Nov 2024 at 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 on 6 Nov 2024 at 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.

Sign in to comment.

More Answers (1)

Subhajyoti
Subhajyoti on 29 Oct 2024 at 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:

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!