Accessing data from a .m file used in an app

조회 수: 30 (최근 30일)
Govind
Govind 2024년 11월 4일 17:58
댓글: Govind 2024년 11월 5일 8:06
I have an app I created using appdesigner and then there are some subclasses which are saved as .m files. For every m file, I have set a version number like this
% versioninfo = 1.0.0
I have set it as a command and in the main program i read the .m file using fireread and look for versioninfo in the output text. So I created all this and I ran the .mlapp to see if it is working, and yes it is working. Then I changed in the .mfile
% versioninfo = 1.0.1
and ran the .mlapp again and this time also it worked perfectly fine.
Next I created a MATLAB app using share and then installing the app into MATLAB app ( i dont have a compiler license - so not standalone app). Then I ran the app first with % versioninfo = 1.0.0 and it worked because when I created the app it was % versioninfo = 1.0.0 in all . mfiles.
Then I changed one of the mfile to
% versioninfo = 1.0.1
but it didnt do any change in the app. So let me understand this correct. When the program creates app it includes all the .mfiles in the app itself. I thought app will be just the .mlapp file and when we run the app it will go and call the .m files from the directory. This is what I thought which is wrong. So all the .mfiles will be included in the app. And we change something in the .mfile we will need to create and reinstall the app again. This is how it works right? I just want to confirm. Thank you.

채택된 답변

Sameer
Sameer 2024년 11월 4일 18:19
Yes, your understanding is correct. When you package a MATLAB app using the App Designer and share it (even without a compiler license for standalone deployment), the app includes all necessary files, including the ".m" files, within the app package itself.
1. App Packaging: When you create an app in MATLAB using the App Designer and package it for sharing, MATLAB bundles all the necessary files into an app package (".mlappinstall"). This includes the ".mlapp" file and any associated ".m" files that your app depends on.
2. Installation: When you install the app in MATLAB, it uses the bundled files from the app package. This means that the app uses the versions of the ".m" files that were included at the time of packaging.
3. Running the App: When you run the installed app, it doesn't reference the external ".m" files from the directory where you originally developed the app. Instead, it uses the versions of the files that were included in the app package.
4. Updating Code: If you make changes to the ".m" files after the app has been packaged and installed, those changes will not be reflected in the installed app. To update the app with the new changes, you need to repackage the app with the updated ".m" files and reinstall it.
Hope this helps!
  댓글 수: 1
Govind
Govind 2024년 11월 5일 8:06
Yes it does, thank you very much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Package and Share Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by