1 执行命令:>> deploytool

选择【Application Compiler】

【选择加号,添加你的应用源码】

【点击,Package】进行打包

然后,生成了如下的目录结构:


2 mbuild

【设定编译器,由于我的系统右VS2019所以,他会自动弹出来,让我进行配置】

>> mbuild -setup
MBUILD 配置为使用 'Microsoft Visual C++ 2019 (C)' 以进行 C 语言编译。要选择不同的语言,请从以下选项中选择一种命令:mex -setup C++ -client MBUILD mex -setup FORTRAN -client MBUILD

3 mcc

mcc Command Arguments Listed Alphabetically

Option    Description    Comment
-a path
Add path to the deployable archive.
If a folder name is specified, all files in the folder are added. If a wildcard is used all files matching the wildcard are added.
-b    
Generate Excel® compatible formula function.
Requires MATLAB® Compiler™ for Excel add-ins
-B filename[:arg[,arg]]    
Replace -B filename on the mcc command line with the contents of filename.
The file should contain only mcc command-line options. These are MathWorks included options files:
-B csharedlib:foo (C shared library)
-B cpplib:foo (C++ library)
-c    
Generate C wrapper code.
Equivalent to -T codegen
-C    
Direct mcc to not embed the deployable archive in generated binaries.
 
-d directory    
Place output in specified folder.
 
-e    
Suppresses appearance of the MS-DOS Command Window when generating a standalone application.
Use -e in place of the -m option. Available for Windows® only. Use with -R option to generate error logging. Equivalent to -W WinMain -T link:exe
The standalone app compiler suppresses the MS-DOS command window by default. To unsuppress it, unselect Do not require Windows Command Shell (console) for execution in the app’s Additional Runtime Settings area.
-f filename    
Use the specified options file, filename, when calling mbuild.
mbuild -setup is recommended.
-g    
Generate debugging information.
None
-G    
Same as -g
None
-I directory    
Add folder to search path for MATLAB files.
 
-K    
Directs mcc to not delete output files if the compilation ends prematurely, due to error.
mcc's default behavior is to dispose of any partial output if the command fails to execute successfully.
-l    
Macro to create a function library.
Equivalent to -W lib -T link:lib
-m    
Macro to generate a standalone application.
Equivalent to -W main -T link:exe
-M string    
Pass string to mbuild.
Use to define compile-time options.
-N    
Clear the path of all but a minimal, required set of folders.
None
-o outputfile    
Specify name of final output file.
Adds appropriate extension
-p directory    
Add directory to compilation path in an order-sensitive context.
Requires -N option
-R option
Specify run-time options for MATLAB Runtime.
option = -nojvm, -nodisplay, -logfile filename, -startmsg, and -completemsg filename
-S    
Create Singleton MATLAB Runtime.
Default for generic COM components. Valid for Microsoft® Excel and Java® packages.
-T    
Specify the output target phase and type.
Default is codegen.
-u    
Registers COM component for current user only on development machine
Valid only for generic COM components and Microsoft Excel add-ins
-v    
Verbose; display compilation steps.
 
-w option
Display warning messages.
option = list, level, or level:string
where
level = disable, enable, error, off:string, or on:string
-W type
Control the generation of function wrappers.
type = main    cpplib:<string> lib:<string> none com:compname,clname,version
-Y licensefile    
Use licensefile when checking out a MATLAB Compiler license.
The -Y flag works only with the command-line mode.
>>!mcc -m foo.m -Y license.lic
-?    
Display help message.


遇到的问题:

问题1

问题2:


问题三:

已经包含了:gentl的adapter,但是,打包的时候

>> imaqhwinfo

ans =

包含以下字段的 struct:

InstalledAdaptors: {'gentl'}
        MATLABVersion: '9.7 (R2019b)'
          ToolboxName: 'Image Acquisition Toolbox'
       ToolboxVersion: '6.1 (R2019b)'

但是,用Mcc -m编译的话依旧出错:


问题4

mcc -o MainGui -W 'WinMain:MainGui,version=1.0' -T link:exe -d H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_testing -v H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m -r 'D:\Program Files\Polyspace\R2019b\toolbox\compiler\Resources\default_icon.ico' -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl 
Compiler version: 7.1 (R2019b)

Dependency analysis by REQUIREMENTS.

Parsing file "H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m"
    (referenced from command line).
Generating file "H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_testing\readme.txt".
正在打包...
Creating the bundle...
Creating the install agent URL file...
Failed to embed install agent URL file, H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_redistribution\installAgentURL.txt, in the installer.
Update resource failed: 5
Failed to embed unzip in your application.
Update resource failed: 5
Failed to create the web based installer.
No installer package created.


问题5

MainGui Executable

1. Prerequisites for Deployment

Verify that version 9.7 (R2019b) of the MATLAB Runtime is installed.   
If not, you can run the MATLAB Runtime installer.
To find its location, enter
  
    >>mcrinstaller
      
at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer.

Alternatively, download and install the Windows version of the MATLAB Runtime for R2019b 
from the following link on the MathWorks website:

https://www.mathworks.com/products/compiler/mcr/index.html
   
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see 
"Distribute Applications" in the MATLAB Compiler documentation  
in the MathWorks Documentation Center.

2. Files to Deploy and Package

Files to Package for Standalone 
================================
-MainGui.exe
-MCRInstaller.exe 
    Note: if end users are unable to download the MATLAB Runtime using the
    instructions in the previous section, include it when building your 
    component by clicking the "Runtime included in package" link in the
    Deployment Tool.
-This readme file

3. Definitions

For information on deployment terminology, go to
https://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.


Preparing Runtime...
mcc -o Tyre_check -W 'WinMain:Tyre_check,version=1.0' -T link:exe -d H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\Tyre_check\for_testing -v H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m -r 'D:\Program Files\Polyspace\R2019b\toolbox\compiler\Resources\default_icon.ico' -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl 
Compiler version: 7.1 (R2019b)

Dependency analysis by REQUIREMENTS.

Parsing file "H:\MainGui.m"
    (referenced from command line).
Generating file "H:\SW\CamerGui\Tyre_check\for_testing\readme.txt".
正在打包...
Creating the bundle...
Creating installer zip archive due to contents exceeding maximum Windows program size.
Self contained installer created at H:\for_redistribution\MyAppInstaller_mcr.zip.
Packaging complete.
Elapsed packaging time was: 3 minutes and 55 seconds.

【案,注意绿色部分,其实是mcc 应用的一些参数的办法】

【如果要调用Gentl Adapter,我做了一点改写的工作就,-a 后面就是调用了adapter】

>> mcc -m -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl MainGui.m 

【案,问题的原因是,我安装的地方是一个USB 移动硬盘,而移动硬盘上的文件大小有限制,把他转移到电脑的硬盘上就好了】


【如果runtim 版本错误,即使安装好了打包的应用程序,运行的时候,任然会报错】

【案,在程序的打包文件夹里说明文件,有个提示】

我们在命令行里面输入“mcrinstaller

>> mcrinstaller

ans =

'C:\Users\frank_sj\AppData\Local\Temp\frank_sj\MCRInstaller9.7\MATLAB_Runtime_R2019b_win64.zip'

这里提示一个安装包,我们把他替换成也是之前要求的版本就好了。

【案,正确的版本可以依据要求直接在官网下载】


笔者搞了很久不行,最后还是在线下载解决了这个问题:


参考:

1

Install and Configure MATLAB Runtime - MATLAB & Simulink - MathWorks 中国

MATLAB生成exe脱离matlab运行可执行程序 - 蒲公英的花 - 博客园 (cnblogs.com)https://www.cnblogs.com/hjj-fighting/p/11381395.htmlMATLAB Runtime - MATLAB Compiler - MATLAB (mathworks.cn)https://ww2.mathworks.cn/products/compiler/matlab-runtime.htmlMATLAB App Designer生成独立GUI(可执行exe)并添加依赖项_star2dust的博客-CSDN博客https://blog.csdn.net/u010038790/article/details/109121710matlab生成exe可执行文件_xiaoxiaoliluo917的博客-CSDN博客_matlab生成exehttps://blog.csdn.net/xiaoxiaoliluo917/article/details/82993493MATLAB--mcc命令 - 小懂 - 博客园 (cnblogs.com)https://www.cnblogs.com/juneja/archive/2008/10/31/1323423.html

【matlab runtime 包】

Standalone Applications - MATLAB & Simulink - MathWorks 中国https://ww2.mathworks.cn/help/compiler/standalone-applications.html?s_tid=srchbrcmStandalone Applications - MATLAB & Simulink - MathWorks 中国https://ww2.mathworks.cn/help/compiler/standalone-applications.html?s_tid=srchbrcm关于matlab AppDesigner打包和解决程序无法识别Runtime的问题_下雨不撑伞丶的博客-CSDN博客_matlab打包app后无法运行https://blog.csdn.net/weixin_47261774/article/details/110534975?spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromBaidu~default-6.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromBaidu~default-6.no_search_link&utm_relevant_index=9

【MATLAB】App Designer程序发布部署打包(打包exe程序)_老子姓李!的博客-CSDN博客_app designer打包https://blog.csdn.net/qq_44078824/article/details/121913857?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1.no_search_link&spm=1001.2101.3001.4242.2&utm_relevant_index=4


Matlab【基础】【02】 将APP打包生成可执行EXE文件相关推荐

  1. python+tkinter+nuitka 打包单个可执行exe文件(PyInstaller比nuitka更稳定)

    1.使用py+tk完成 简单图形化脚本 # coding = utf-8 import tkinter as tk from tkinter.scrolledtext import * import ...

  2. postman生成python代码_python代码直接生成可执行exe文件

    前言: python中有一个很厉害的库可以直接将写好的python代码打包成可执行的.exe文件,生成好的文件不需要python运行环境和pycharm等IDE就可以直接双击运行,是不是很厉害呢!这样 ...

  3. QT基础入门【调试篇】QT程序如何打包发布生成可执行exe文件(win下的可执行程序)

  4. php程序打包exe文件下载,手把手教你把前端代码打包成msi和exe文件

    本文主要介绍Electron应用如何打包成msi和exe文件. 由于介绍Electron打包成msi和exe的文章很少,官方的文档也一笔带过,在研究的过程中踩了很多坑,所以写下此文,给其他人一个参考. ...

  5. python打包成exe fail to ex_“failed to excute script xxx” PyInstaller 打包python程序为exe文件过程错误...

    在使用PyInstaller打包python程序,打包命令为: pyinstaller -F -w -i manage.ico yourpyfile.py 顺便说一下几个参数的作用 -F:是直接生成单 ...

  6. Java Maven项目打包成可执行jar文件

    在pom文件中添加一下内容 <build><plugins><plugin><!-- Build an executable JAR --><gr ...

  7. Matlab App Designer 【02】APP打包和安装

    APP发布和部署 一.安装到Matlab主界面APP 二.安装到Web端 解压MATLABWebAppServer.zip 安装MATLAB Runtime 设置路径 配置MATLABWebAppSe ...

  8. Python生成Windows可执行exe文件

    环境 python3.6.5 pyinstaller3.5 windows 10 下载地址 python:https://www.python.org/ftp/python/3.6.5/python- ...

  9. Python-python程序打包为独立的EXE文件,并配上自定义的图标

    http://mini.eastday.com/mobile/171219033905969.html python是解释型语言,学习阶段都是用解释器加载运行的.不过在教小朋友的时候,如果先教会他们如 ...

最新文章

  1. day22 time模块
  2. C#调用python文件
  3. HTTP消息中Header头部信息整理
  4. 清华大学python镜像_使用清华开源镜像安装tensorflow
  5. NPM使用前设置和升级
  6. mysql5.6免安装配置(菜鸟版)
  7. HDU2570 迷瘴【贪心】
  8. 徘徊于斗牛之间 —— 星象、星宿与星座(风水)
  9. 敏捷需求描述:用户故事
  10. 电子系统设计实践——软件编写
  11. 计算机网络实验报告双机互联,双机互联实验报告.docx
  12. 各大cdn厂商的cname域名
  13. 张启发院士给他的博士生的一封信(转载)
  14. elementUI控制表格样式(表格头、表格行、表格列)
  15. html中的问号有什么作用,html语言中一开始的问号和双斜槓表示什麼意思?
  16. 《SteamVR2.2.0之Skeleton_Poser》(Yanlz+Unity+XR+VR+AR+MR+SteamVR_Skeleton_Poser+Skeleton+Poser+立钻哥哥+==)
  17. 利用amWiki轻松打造知识库或技术文档系统
  18. JDBC学习笔记之java日期与mysql日期转换
  19. AD 入门2 一步步学PCB画板
  20. 网络安全必学知识点之XSS漏洞

热门文章

  1. The finally block does not always execute in try finally
  2. JavaScript性能优化【中】-- Performance 工具
  3. let 作用域问题, 全局变量不能this引用
  4. 【折腾】斐讯N1 安装 Docker + GUI
  5. 【Python】一些函数
  6. C#LeetCode刷题之#682-棒球比赛(Baseball Game)
  7. python ctypes
  8. html块状元素和内联元素_HTML中的内联元素和块元素-解释
  9. javascript 图表_我如何使用JavaScript数据透视表和图表库分析开发人员趋势
  10. 没有事情,错误1503_为什么依靠用户报告错误是您做过的最愚蠢的事情