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
 breaking up files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jspector

USA
Posts

Posted - 03/28/2008 :  2:25:12 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: XP


I have imported an ascii file into worksheet "Data1".
I want to break the file up into a number of pieces the user specifies, and put them each in their own worksheet.
I've got it set up now where it asks how many worksheets will need to be created and it creates them. My question, is how do I assign values to
a worksheet based on what is in another worksheet ? What I mean is say Data1 1 has 3 columns each of 100 rows, and I want worksheet Data2 to have the values from rows 1-23 of Data1, Data3 to be 24-75 and Data4 to be 76-100

Can someone help ?
thanks,
-Jeff

Deanna

China
Posts

Posted - 03/31/2008 :  02:35:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jeff,
I have written an example below. It shows you how to copy Row 11 to 23 of the first column of the Data1 worksheet to the 1st column of the Data2 worksheet. Maybe you can rewrite it as you need.



void test6710()
{
Worksheet wksSrc("Data1"); // Create Origin C Worksheet object and attach to Origin Data1 worksheet
Dataset dsSrc; // Create unattached Dataset object
dsSrc.Attach(wksSrc, 0); //Attach to the first column of Data1

Dataset dsCopy( dsSrc); //Make a copy of the source data
dsCopy.SetLowerBound(10); //From Row 11
dsCopy.SetUpperBound(22); //To Row 23
dsCopy.TrimLeft(TRUE);

Worksheet wksDst("Data2");
Dataset dsDst; // Create unattached Dataset object
dsDst.Attach(wksDst, 0); //Attach to the first column of Data2

dsDst = dsCopy;

}


Deanna
OriginLab Technical Services
Go to Top of Page

jspector

USA
Posts

Posted - 03/31/2008 :  11:51:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks! I got it to work just before I read your reply, but your code is much neater than mine is..
-jspector
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