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 Origin C
 Copy Column from Worksheet "A" to WS "B"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Hellron

Germany
Posts

Posted - 08/17/2007 :  04:15:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (7.5):
Operating System: Win 2000

Hello,

I'm pretty new to Origin an C aswell. For my little internship
@ Infineon AG I've to use Origin an C (btw. just started to learn C)
so it's perhaps a "noob" Question but well...

I need to copy different Columns from one Worksheet to another and paste it there. In detail: I've got three Workseet's "Data", "Data1", "Data2" and from each Worksheet I need Colmun 3,10, 17 and so on and copy it to a Worksheet called "Mittelwert" to a Column named "ID". In this colum the copied Data shoult added to the Data in the Colum to get the average later.

Would be nice, if someone could help me there!

Thank's a lot!

zachary_origin

China
Posts

Posted - 08/17/2007 :  09:44:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Not very sure what did you mean exactly for "added to the Data in the column". However, to manipulate on the columns, you can write something like the following...


Worksheet wksData("Data");
Dataset dsA(wksData, 2); //in Origin C it starts as 0,
Dataset dsB(wksData, 9);
Dataset dsC(wksData, 16);
Worksheet wksMitt("Mittelwert");
Dataset dsID(wksMitt, 3); //assume column "ID" is the 4th column
dsID = (dsA + dsB + dsC)/3.0; //directly calculate with the datasets


you can search in the Help with keyword worksheet and dataset for more information...

Go to Top of Page

Hellron

Germany
Posts

Posted - 08/17/2007 :  10:55:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Well tank you very much - that's what I wanted to do. Ok, not exactly the same but pretty close! My problem was that I wasn't confirm how the dataset worked and well didn't use the right syntax.
I tried to do it with the Helpfiles but did it wrong somehow. I used the [ Dataset dsID.Attach("Data"); ] and that didn't work. Aswell as some other combinations.

Again, thank you - now I got to transfer it and change it to some varibales. Now I've to try to get the Dataset directly with the columnes. Hope that will work.

Thank you again! Made my day :)

Ingo
Go to Top of Page

Hellron

Germany
Posts

Posted - 08/20/2007 :  08:01:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok - still got a Problem. After I worked the thing out for couple of Worksheets I get an Error which I can't get lost of.

In this line:

dsVD1PUT = (dsVD11 + dsVD12)/2;

the programm (not the compiler) stops with this error (it's the line):

H:\My AppData\Origin Data\AKL_Greese\import.cpp(127) :Origin C Function Runtime Error, unknown error

It work's only if I change the line like this:

dsVD1PUT = dsVD11;

but that's not what I want because I need the averga value...

Hope you can help again!

Greetings, Ingo
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/20/2007 :  10:00:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
dsVD11 and dsVD12 are probably not the same size. That is, the columns to which they are attached do not have the same number of rows. You can pad the shorter column with zeros like this...
	int n1 = dsVD11.GetSize();
int n2 = dsVD12.GetSize();
if( n1>n2 )
dsVD12.InsertAt(n2,0,n1-n2);
if( n2>n1 )
dsVD11.InsertAt(n1,0,n2-n1);
dsVD1PUT = (dsVD11 + dsVD12)/2;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/20/2007 11:46:15 AM
Go to Top of Page

Hellron

Germany
Posts

Posted - 08/21/2007 :  01:35:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Good morning :)

Well it try that - could be that there is a difference in the amount of the dataset. But the problem is: I need the clause for 3 Datasets. So dsVD11, dsVD12 and dsVD13 - same with ID and so on. I've about 50 Dataset's so it wouldn't bei nice to do that if - clause for 50 Set's. Is there anoter way?

cYa - Ingo

Edit2: Well' I think I got that solved... Hope ther is no other prob upcoming.

Edited by - Hellron on 08/21/2007 02:25:44 AM

Edited by - Hellron on 08/21/2007 03:59:24 AM
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