| T O P I C R E V I E W |
| L007 |
Posted - 07/15/2008 : 10:58:48 AM hello,
I´m using Origin 7.5. I have multiple sets of curves to be subtracted, so wanted to build one graph with both terms Y1 and Y2 (using Origin notation: Y = Y1 - Y2), where Y1 and Y2 would be grouped in sequence in two separate groups. I wanted to calculate Y, placing the results in new worksheets (otherwise Origin wouldn´t keep the original data, that will be used further on).
I figured out how to subtract two datasets with Labtalk, but I don´t know how to select the curves for performing the calculations! In other words, I don´t know how to start heheh
I appreciate any help! |
| 6 L A T E S T R E P L I E S (Newest First) |
| larry_lan |
Posted - 07/22/2008 : 10:17:09 PM Hi:
We don't have a property to distinguish curves in different groups. Sorry about that. |
| L007 |
Posted - 07/17/2008 : 08:08:40 AM Hi,
Not exactly. If I understood correctly, your scrpit assumes that you have:
Layer1 curve1 curve2 ... curven
active dataset: curvek
then you will calculate:
Layer1 curve1+curvek curve2+curvek ... curven+curvek
The script I´ve posted does this; given
Layer1 Layer2 curve11 curve21 curve12 curve22 ... ... curve1n curve2n
it gives
Layer2 curve11+curve21 curve12+curve22 ... ... curve1n+curve2n
but I want to modify that to:
Initial data
Layer1 Group1 Group2 curve11 curve21 curve12 curve22 ... ... curve1n curve2n
Calculated Layer1 Group3 curve11+curve21 curve12+curve22 ... ... curve1n+curve2n
|
| larry_lan |
Posted - 07/16/2008 : 10:35:32 PM Hi:
Do you mean you want to perform some calculation on all the curves in a layer? If so, I think the doc -e D command should work. For example, this script Add tow curves in the active layers:
%A = %C; // Get Active dataset name;
doc -e D
{
If ( %A != %C )
{
// All curves in the active layer will plus %A (Except %A)
%C +-O %A;
}
}
Hope this helps.
Thanks Larry OriginLab Technical Services |
| L007 |
Posted - 07/16/2008 : 6:05:21 PM Well, I managed to put this code to work:
loop(ii,1,count) { lay -s 1; %A=%(ii, @D); lay -s 2; %B=%(ii, @D); %B +-O %A; }
now,is it possible to substitute the lay command to select the datasets by a similar command that deals with datasets whithin a group of curves? |
| L007 |
Posted - 07/16/2008 : 08:40:35 AM Shirley,
I know I can use the Analysis -> Simple Math, but the problem is that I have to perform several dozens of calculations several dozens of time, and the dialog in Origin 7.5 is not user friendly when you have more than some hundreds of columns in a project. That´s why I need an script to automate this process of calling this procedure.
I know I can call this operation with the following syntax in labtalk:
dataset1 +-O dataset2a
What I´m not familiar with labtalk is how to identify select whithin a graph dataset1 and dataset2a as I specified before: dataset1 from group1 and dataset2 from group2, where dataset2a is a copy from the original dataset dataset2. |
| Shirley_GZ |
Posted - 07/15/2008 : 11:04:52 PM Hi,
If you want to apply a subtration operations on plotted data, you can select Analysis:Simple Math or Analysis: Subtract: Reference Data to open the Math on/between Dataset Dialog Box when the graph is active.
By the way, Origin subtracts each value in Y1 from the corresponding value in Y2 and saves and plots the result as Y1 after clicking ok. If you want to keep the Original data, you should duplicate the data of Y1 and Y2 to a new worksheet before you do this function.
If you want to write a labtalk script, I think there will be more presumptions you need to consider, like that if the number of points of these two curves are different, you need apply the interpolation.So I think the way from GUI is more easy.
More information about this function you can see here: Help: Analysis: Basics > Math Operations on Plotted Data > Performing Math Operations
Shirley Tian
Originlab Technical Service Team |
|
|