Get Version number of MATLAB app

조회 수: 71 (최근 30일)
Govind
Govind 2024년 10월 29일 13:03
댓글: dpb 2024년 11월 6일 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.

채택된 답변

dpb
dpb 2024년 10월 29일 16:21
편집: dpb 2024년 10월 29일 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
Govind
Govind 2024년 11월 6일 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 2024년 11월 6일 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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Subhajyoti
Subhajyoti 2024년 10월 29일 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:

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by