Re-import an exported Matlab app
27 views (last 30 days)
Background: I am developing an app through the Matlab App Designer (2020b), and I'm using Git to keep track of changes. However, since the .MLAPP file is a binary file, the only way to see what has changed is to export the app to .M, and then comparing the deltas of the .M file. Now, if me and a collaborator both make (non-conflicting) changes to the .MLAPP, we cannot automatically merge the changes and obtain a combination of our work. With the .M files we can merge each others changes, but then we cannot continue development in the App Designer because there is no way to turn the .M back into .MLAPP.
Question: Is there a way to re-import an .M file, created by exporting an .MLAPP file, into the App Designer? Alternatively, how do I go about collaborating and maintaining .MLAPP code through Git?
Kiran Felix Robert on 8 Feb 2021
From MATLAB R2020b, you can use MATLAB comparison tool to diff and merge two mlapp files as documented in Compare and Merge Apps with some limitation. See "Tips for Successful Merge" Section in Compare and Merge Apps
Also, you can also setup git inside MATLAB to perform different git actions as documented in Source control integration. This generic MATLAB git support works mostly for mlapp file as well.
For example, when user has conflict on MLAPP file, use can resolve git conflicts by using Source Control > View Conflicts, then user can merge code differences by using MATLAB merge tool for MLAPP file. See "Resolve source Control Conflict" Documentation.
You can also learn to use this merge tool for mlapp files by watching this youtube video : How to Merge App Designer Apps with the MATLAB Comparison tool.
There is no easy way to import the exported "m" file into AppDesigner. The "mlapp" file is a structure which contains metadata and XML files, whereas, the "m" file contains only the code. In order to directly import the app file, the metadata and the XML files would be needed, which are not present in the "m" file.