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
 Beginner Needs Help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

PUGrad

USA
Posts

Posted - 06/20/2007 :  10:09:58 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: Windows XP

I've got 2 1-D arrays, each with 500 points. They are created and filled in an origin C program. How to I write them to a worksheet, so that it will show the values of one array in Col A and one array in Col B. I've looked around and done a lot of readin, and am still a but confused on this point...
thanks..

Mike Buess

USA
3037 Posts

Posted - 06/20/2007 :  11:07:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you really mean array (e.g., double aa[500]) rather than vector (vector<double> vv(500)) then you must set the cell values one at a time...

double a1[500],a2[500];
// set array values
Worksheet wks = Project.ActiveLayer();
for(int i=0;i<500;i++)
{
wks.SetCell(i,0,a1[i]); // col A
wks.SetCell(i,1,a2[i]); // col B
}

It's much easier with vector...

vector v1(500),v2(500);
// set vector values
Worksheet wks = Project.ActiveLayer();
Dataset d1(wks,0),d2(wks,1);
d1 = v1; // set col A
d2 = v2; // set col B

Mike Buess
Origin WebRing Member
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