-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOPY_CLASS_DataObject-Formula.html
More file actions
38 lines (35 loc) · 3.89 KB
/
OPY_CLASS_DataObject-Formula.html
File metadata and controls
38 lines (35 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<h1 class="firstHeading">8.1.3.6 DataObject::Formula</h1><table class="noborder"><tr>
<td style="vertical-align:top" width="60"><img src="../images/OPY_CLASS_DataObject-Formula/Tip_icon.png?v=21427" width="57" border="0" /></td><td><h3><a name="It_is_recommended_that_you_switch_to_the_originpro_package._PyOrigin_is_primarily_for_users_who_need_to_work_with_Origin_version_prior_to_2021."></a><span class="mw-headline"><span style="color: red">It is recommended that you switch to the <a href="../../Python/Python/RunPython_(Python).html" title="Python:RunPython (Python)">originpro</a> package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.</span></span></h3>
</td></tr></table>
<p><br />
</p>
<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">1</span> <span class="toctext">Description</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Name"><span class="tocnumber">2</span> <span class="toctext">Name</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Examples"><span class="tocnumber">3</span> <span class="toctext">Examples</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#See_Also"><span class="tocnumber">4</span> <span class="toctext">See Also</span></a></li>
</ul>
</div>
<h2><a name="Description"></a><span class="mw-headline">Description</span></h2>
<p>Get/Set the LabTalk formula and optional Before Formula Script for Column and MatrixObject
</p>
<h2><a name="Name"></a><span class="mw-headline">Name</span></h2>
<p>Formula
</p>
<h2><a name="Examples"></a><span class="mw-headline">Examples</span></h2>
<pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> PyOrigin
wks<span style="color: #000;">=</span>PyOrigin.<span style="color: #000;">ActiveLayer</span><span style="color: #000;">(</span><span style="color: #000;">)</span>
colA<span style="color: #000;">=</span>wks.<span style="color: #000;">Columns</span><span style="color: #000;">(</span><span style="color: #000;">0</span><span style="color: #000;">)</span>
colA.<span style="color: #000;">SetFormula</span><span style="color: #000;">(</span><span style="color: #0a0;">"5*(i-1)"</span><span style="color: #000;">)</span>
colA.<span style="color: #000;">ExecuteFormula</span><span style="color: #000;">(</span><span style="color: #000;">)</span>
colB <span style="color: #000;">=</span> wks.<span style="color: #000;">Columns</span><span style="color: #000;">(</span><span style="color: #000;">1</span><span style="color: #000;">)</span>
strExpression <span style="color: #000;">=</span> <span style="color: #0a0;">"cos(Amp*x*pi/180)"</span>
strBeforeScript <span style="color: #000;">=</span> <span style="color: #0a0;">"double Amp=4.5;"</span> + <span style="color: #0a0;">"<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>"</span> + <span style="color: #0a0;">"range x=col(A);"</span>
strFormula <span style="color: #000;">=</span> strExpression + <span style="color: #0a0;">";<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>#"</span> + strBeforeScript
colB.<span style="color: #000;">Formula</span><span style="color: #000;">=</span>strFormula
colB.<span style="color: #000;">ExecuteFormula</span><span style="color: #000;">(</span><span style="color: #000;">)</span></pre>
<h2><a name="See_Also"></a><span class="mw-headline">See Also</span></h2>
<p><a href="../../Python/Python/OPY_CLASS_DataObject-GetFormula.html" title="Python:OPY CLASS DataObject-GetFormula">GetFormula</a>
<a href="../../Python/Python/OPY_CLASS_DataObject-SetFormula.html" title="Python:OPY CLASS DataObject-SetFormula">SetFormula</a>
</p>