MATLAB: Can I integrate MLAPP files from App Designer with Git source control

appdesignergitMATLABmlapp

Git cannot seem to track the plain text changes made to MLAPP source files from App Designer. Is there any workaround for the issue?

Best Answer

  • This is a known limitation of MLAPP files with version control. An enhancement request has been submitted for supporting version control of MLAPP files with Git. Our development team may consider this feature for a future release.
    Possible workaround:
    The current recommended workflow for version controlling MLAPP files with Git is to export the MLAPP file to a MATLAB code file (.m) and check-in this exported MATLAB code file with the MLAPP file. MATLAB R2018b added the ability to export an MLAPP-file directly to a M-file using the "Save -> Export to .m file" option on the App Designer's "Designer" toolstrip tab.
    One potential workflow is to:
    1. Save the app
    2. Export the app to an .m file
    3. Check in both the .mlapp and .m file to Git
    4. Repeat for the next revision
    While this does not offer merging of the app's code, it does offer change-tracking of the M-file that could be diffed as almost every aspect of the app appears in the generated code. So you could see if another developer added or removed components from the app by looking at the code added/removed. Also, when you export to an M-file, it will automatically append "_exported" to the file name, so you will not need to worry about it shadowing your MLAPP file.
    An MLAPP file is a binary file similar to an MLX file and so it should be registered with Git as a binary format to prevent it from being corrupted. See the "Register Binary Files with Git" section in our documentation for more information: