The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Automation Server/COM and LabVIEW
 Applying Templates (MATLAB)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sudd0030

11 Posts

Posted - 01/26/2016 :  6:40:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

In the MATLAB example, a seemingly random number was used apply the symbol+line template (or is this to apply a theme??):
% Add data plot to graph layer
invoke(dps, 'Add', dr, 202); % 202 for symbol+line plot

Is there anyway to determine the number that is associated with a user-defined template?

Thanks,
John

Origin 2016
Operating System: Win10

sudd0030

11 Posts

Posted - 01/27/2016 :  12:11:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So far what I've found is that these numbers correspond to these line type:

% 200 -- line
% 201 -- symbol
% 202 -- symbol+line

I found some documentation that makes it appear that the template is applied with the CreatePage command:
CreatePage(PAGE_TYPE_WKS, "Data", "w", PAGE_VISIBLE); //"w" is template name while "Data" as worksheet page name

How does this syntax translate to MATLAB, and how do I use a user-defined template?

Something like this perhaps?

graph = invoke(originObj, 'CreatePage', 3, 'GraphName', 'Template Path')

Will I have to write the full path of the template?
Or will I have to copy my user-defined template into the folder with the origin default .OTP files?

Thanks for any advice,
John
Go to Top of Page

sudd0030

11 Posts

Posted - 01/27/2016 :  1:39:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So using the full template path does seem to work. This is the code I used:

myTemplatePath = C:\Users\myUsername\Documents\OriginLab\2016\User Files\myTemplate.otp
graph = invoke(originObj, 'CreatePage', 3, 'myGraphName', myTemplatePath)

'myGraphName' will show up as the label to the graph window.
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 03/01/2016 :  02:45:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can refer to this page for the plot index:
http://www.originlab.com/doc/COM/PLOTTYPES

If you modify the graph and save the template as NewTmp (as shown in graph),

you can use the 'NewTmp' in your code instead of 'Origin'

eg: in example file: Origin2016\Samples\COM Server and Client\MATLAB\MATLABCallOrigin.m line 64

% Create a graph
strGraph = invoke(originObj, 'CreatePage', 3, '', 'Origin');

can be replaced by
strGraph = invoke(originObj, 'CreatePage', 3, '', 'NewTmp');

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 03/01/2016 02:48:03 AM
Go to Top of Page

VladGets1

Germany
12 Posts

Posted - 11/01/2016 :  07:51:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I do not have this label. Help me please.
quote:
Originally posted by sudd0030

So using the full template path does seem to work. This is the code I used:

myTemplatePath = C:\Users\myUsername\Documents\OriginLab\2016\User Files\myTemplate.otp
graph = invoke(originObj, 'CreatePage', 3, 'myGraphName', myTemplatePath)

'myGraphName' will show up as the label to the graph window.

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000