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
 Origin Forum
 plotting and averaging with Origin-c
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tonyv

Germany
Posts

Posted - 05/07/2007 :  06:49:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: Windows Vista

Hi,

I have difficulty to find a Origin-c function which plots several "y" columns (the same x) in one plot and a Origin-c function which averages them.

Thank you for any help!

Tony

Mike Buess

USA
3037 Posts

Posted - 05/07/2007 :  09:01:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tony,

GraphLayer::AddPlot will add one column or the entire worksheet to a graph layer. See the examples for usage. The following function will average all Y columns in the active worksheet...
void average_all_Y_columns()
{
Worksheet wks = Project.ActiveLayer();
int nCols,iCol = wks.AddCol();
Dataset dsX(wks,0);
Dataset dsY(wks,iCol);
dsY.SetSize(dsX.GetSize());
dsY = 0;
for(int i=0;i<iCol;i++)
{
if( OKDATAOBJ_DESIGNATION_Y == wks.Columns(i).GetType() )
{
Dataset ds(wks,i);
dsY += ds;
nCols++;
}
}
dsY /= nCols;
}


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