Conversion from .M to .MLAPP (Matlab files)
Updated 25 May 2023


View m2mlapp on File Exchange

Conversion from .M to .MLAPP (Matlab files)

M2MLAPP provides the conversion from .M to .MLAPP, enabling GitHub text line based control, and allowing the reconstruction of apps whose .MLAPP files are damaged.


mlappFullPath = m2mlapp(mFileFullPath, varargin);


  • mFileFullPath must be a scalar text (char | string) with the fullpath to the .M file.

Optional Name-Parameters Arguments:

(argument name, type, and default value)

  • Name scalar text (char | string) = ClassName
  • Author scalar text (char | string) = ''
  • Version scalar text (char | string) = '1.0'
  • Summary scalar text (char | string) = ''
  • Description scalar text (char | string) = 'App code generated by m2mlapp.'
  • Screenshot logical = true
  • OpenApp logical = true


(a) The images referenced in the app (icon figure, uiimage, uibutton) must be in the Matlab search path during the execution of the m2mlapp function.

(b) After validating the input arguments, the function will return the name of the .MLAPP file, or in case of a parser error, it will return an empty output.

(c) A class loaded in the AppDesigner environment has a fixed structure, which limits customizations. In this structure, the first section is the declaration of components (according to their stacking order); then there are editable sections (properties, methods, and callbacks); and finally, the methods for creating components, and construct or delete the app.


Example 1 - Basic convertion (.M >> .MLAPP)

m2mlapp('C:\GitProject\winMain.m', 'Author', 'Eric Magalhães Delgado', 'Version', '1.01');

Example 2 - Rebuilding a broken .MLAPP file (.MLAPP >> .M >> .MLAPP)

mlappFileFullPath  = 'C:\GitProject\winMain.mlapp';
[mPath, mFilename] = fileparts(mlappFileFullPath)
mFileFullPath      = fullfile(mPath, [mFilename '.m'])

matlabCode = util.extractMATFile(mlappFileFullPath)
writematrix(matlabCode, mFileFullPath, 'FileType', 'text', 'QuoteStrings', false)

movefile(mlappFileFullPath, fullfile(mPath, [mFilename '_old.mlapp']))

Cite As

Eric Delgado (2024). m2mlapp (https://github.com/EricMagalhaesDelgado/m2mlapp/releases/tag/1.01), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with R2021b to R2023a
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

See release notes for this release on GitHub: https://github.com/EricMagalhaesDelgado/m2mlapp/releases/tag/1.01

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.