Large quantities of fine mapping can be used in this post, with reference to the official website: https://www.originlab.com/doc/COM and https://www.originlab.com/doc/COM/Classes (official website is to VB , C # and the like, can refer to, in fact, almost)
1. Make a template and theme (Simple omitted)
2. MATLAB programming
-
Create automated service object
1. originObj = actxserver('Origin.ApplicationSI'); % 获得Origin自动化服务对象(通过COM接口)
2. invoke(originObj, 'Execute', 'doc -mc 1;'); % 操作可视化
3. invoke(originObj, 'IsModified', 'false'); % Clear "dirty" flag in Origin to suppress prompt for saving current project
- Workbooks can create your own, you can also use the template generation. Create your own templates and generate commands are as follows:
1. strBook = invoke(originObj, 'CreatePage', 2, '', 'Origin'); % 创建工作簿,返回工作簿名称strBook
2. invoke(originObj, 'Load', '模板路径'); % 打开模板(注意模板路径包含完整路径信息,文件扩展名为.OPDJ)
- Worksheet related operations
1. wks = invoke(originObj, 'FindWorksheet', strBook); % 找到名为“strBook”的工作簿中的工作表,注意如果工作簿中的工作表大于1时该命令无效,需要用下面一条命令。
2. wks = invoke(originObj, 'FindWorksheet', '[Book1]Sheet1'); % Book1为工作簿名称,Sheet1为工作表名称
3. invoke(wks, 'Name', 'MySheet'); % 工作表重命名为MySheet
4. invoke(originObj, 'PutWorksheet', '[Book1]Sheet1', Data); % 向工作表中导入数据,其中Data为需要导入的数据,一般为矩阵形式;Book1为工作簿的名称;Sheet1为工作表的名称
- Pictures related operations
1. strGraph = invoke(originObj, 'CreatePage', 3, '', 'Origin'); % 创建图片,返回名称
2. gl = invoke(originObj, 'FindGraphLayer', strGraph); % 获取名称为strGraph的图片的图层
3. invoke(originObj, 'CopyPage', 'Graph1'); % 图片复制到剪切板,其中Graph1为图片名称
- Release the object
release(originObj); % 释放之后才能关闭Origin,否则无法关闭
3. Batch Export Pictures (Simple omitted)
to be continued. .
Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed.