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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 multiplication of datasets

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 HyperlinkUpload FileInsert 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 [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
slooff Posted - 08/28/2006 : 09:36:08 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System:Windows 2000

Hello to all,

It sounds very basic, but I cannot find the answer.
I want to multiply two datasets data61 and am15, and put the result in a new dataset. The x-values are given in column A and are different for both datasets. The y-values are given in column B.

How do I address these datasets in C and how can I perform the multiplication?

Thanks in advance.
Best regards,

Lenneke
4   L A T E S T    R E P L I E S    (Newest First)
vicore Posted - 06/28/2011 : 05:24:52 AM
Hi,

sorry for the maybe much too easy question, but how where can I write and run the code? The "Window>Script Window"-window doesnt execute the command. Thanks for your help.

Best Regards
slooff Posted - 08/29/2006 : 03:37:06 AM
Dear Mike,

Thanks, that works indeed!
This helps me a lot.

Regards,

Lenneke
Mike Buess Posted - 08/28/2006 : 2:51:14 PM
Hi Lenneke,

Seems to me you want to multiply two curves that have different X values. While it is possible to evaluate the Y values of one curve at the X values of the other and then multiply directly, it's easier in this case to use LabTalk's *-O operation...

Worksheet wks1("data61"),wks2("am15"),wks3;
wks3.CreateCopy(wks1);
Dataset ds3(wks3,1),ds2(wks2,1);
LT_execute(ds3.GetName() + " *-O " + ds2.GetName());

Mike Buess
Origin WebRing Member
zachary_origin Posted - 08/28/2006 : 12:04:09 PM
Hi Lenneke,


I do not know what your meaning of multiply two datasets.
But for how to manipulate the elements of the datasets, you can see the following example, which adds x and y of the two datasets respectively and stored in a new dataset.


void ManipulateDataset()
{

Dataset dsAX("data1_a"), dsAY("data1_b");//data1 is the name of workbook for the first dataset, column A as x and column B as Y.
Dataset dsBX("data2_a"), dsBY("data2_b");//data2 is the name of workbook for the second dataset, column A as x and column B as Y.
Dataset dsCX("data3_a"), dsCY("data3_b");//data3 is the name of workbook for the results

int nSize = dsAX.GetSize()> dsBX.GetSize()? dsBX.GetSize(): dsAX.GetSize();

dsCX.SetSize(nSize);//Set the size of data3 as the min of data1 and data2
dsCY.SetSize(nSize);

//here is to show how to access each element of the dataset,
//in fact, you can simply use
//dsCX = dsAX + dsBX;
// to add two columns.

for(int ii = 0; ii<nSize; ii++)
{
dsCX[ii] = dsAX[ii] + dsBX[ii];// x3 = x1 + x2;
dsCY[ii] = dsAY[ii] + dsBY[ii];// y3 = y1 + y2;
}

}





For more information about dataset, please reference to Help > Programming > Origin C Language Reference > Classes > Dataset, vector and vectorbase. There are many detailed examples you can learned from.




Zachary
OriginLab GZ Office

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