Skip to content

EricMagalhaesDelgado/m2mlapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

m2mlapp

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.

Syntax:

mlappFullPath = m2mlapp(mFileFullPath, varargin);

Arguments:

  • 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

Notes:

(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.

Examples:

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']))
m2mlapp(mFileFullPath)

About

Conversion from .M to .MLAPP (Matlab files)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages