retrieve version inside AppDesigner appplication (.mlapp file)

Does anyone know how to retrieve (programmatically) the version inside an .mlapp file?
This property is available on top level of the GUI, in picture below it is 1.02. I'd like to display it in a text label in the app.

回答 (1 件)

Image Analyst
Image Analyst 2024 年 5 月 27 日
編集済み: Image Analyst 2024 年 5 月 27 日

0 投票

Did you try
s = ver('MATLAB');
releaseYear = s.Release(2:end-1);
releaseVersion = s.Version;
fprintf('You are using MATLAB Release %s, version number %s.\n', releaseYear, releaseVersion);
app.yourTextBox.Value = releaseVersion;

5 件のコメント

Han Geerligs
Han Geerligs 2024 年 5 月 27 日
編集済み: Han Geerligs 2024 年 5 月 27 日
Hello,
thanks for your response.
This question is not about displaying the Matlab version, but about getting the version of an .mlapp file.
Image Analyst
Image Analyst 2024 年 5 月 27 日
You can get the file date from dir.
I don't think there is a version for an .mlapp file. So you're best off just having a file called VersionNumber.txt in your folder and then having a function, like the attached, to read in your version into a variable. This is what I do.
Han Geerligs
Han Geerligs 2024 年 5 月 28 日
Thanks for responding.
In the meantime I have done some investigation.
It is possible to extract (unzip) the contents of the file <name>,mlapp. In fact this is an OPC container.
When looking at the file /metadata/coreProperties.xml I can obtain the version for the .mlapp file (see below in bold underlined).
I was looking for an API to get this value.
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<cp:coreProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
<dcterms:created xsi:type="dcterms:W3CDTF">2024-03-20T10:09:56Z</dcterms:created>
<dc:creator>Seatools</dc:creator>
<dc:description>PLC/local/Jenkins: Compare and deploy to PLC</dc:description>
<dcterms:modified xsi:type="dcterms:W3CDTF">2024-05-28T06:32:17Z</dcterms:modified>
<dc:title>CompareFiles</dc:title>
<cp:version>1.02</cp:version>
</cp:coreProperties>
Image Analyst
Image Analyst 2024 年 5 月 28 日
編集済み: Image Analyst 2024 年 5 月 28 日
You or others might find the attached utility useful. It reads an XML file into a structure, which is more familiar, convenient, and easy to use for most of us.
Han Geerligs
Han Geerligs 2024 年 5 月 29 日
thanks for posting the utility.
I have used the example on https://nl.mathworks.com/help/matlab/ref/xmlread.html. However this has some identical code as xml2struct.m!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2024 年 5 月 27 日

コメント済み:

2024 年 5 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by