The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Automation Server/COM and LabVIEW
 Applying Templates (MATLAB)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
sudd0030 Posted - 01/26/2016 : 6:40:36 PM
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
4   L A T E S T    R E P L I E S    (Newest First)
VladGets1 Posted - 11/01/2016 : 07:51:44 AM
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.

jasonzhao Posted - 03/01/2016 : 02:45:57 AM
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
sudd0030 Posted - 01/27/2016 : 1:39:40 PM
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.
sudd0030 Posted - 01/27/2016 : 12:11:04 PM
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

The Origin Forum © 2008 Originlab Corporation Go To Top Of Page
Snitz Forums 2000