Author |
Topic  |
|
ungat
Belgium
Posts |
Posted - 05/25/2005 : 08:16:32 AM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System:Windows XP
Hello, my analytical work involves a lot of repetitive tasks:
1)I have to import several dozens of ASCII files (each file has two columns A(X),B(Y))
2)Rename each Y column by the name of worksheets
3)normalize each Y column by dividing column Y by the area of its curve. (plot Y and perform integration of its curve)
4)multiplie column X by normalized column Y and put the result in a third column Y called C
5) perform integration of column C and put the result in a column D there is an example here:
/*------------------------------------------------------------------------------* * File Name: NormalizeAllYColumns.c * * Creation: ER, 02/07/05 * * Purpose: Programming Example * * Copyright (c) OriginLab Corp.2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 * * All Rights Reserved * * * * Modification Log: * *------------------------------------------------------------------------------*/ #include <Origin.h>
//////////////////////////////////////////////////////////////////////////////////// // This function normalizes the data in all Y columns, dividing the column values // by the max value found in the column. // void normalize_all_y_columns() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } foreach( Column col in wks.Columns ) { if( OKDATAOBJ_DESIGNATION_Y == col.GetType() ) { Dataset ds(col); double dMin, dMax; ds.GetMinMax(dMin, dMax); ds /= dMax; } } } ////////////////////////////////////////////////////////////////////////////////////
but I don't want to normalize the data in all Y columns, dividing the column values by the max value found in the column but dividing the column values by the area value of their curves.
Please, could you help me to create this function ?
Thanks
|
|
skelton
China
Posts |
Posted - 06/07/2005 : 05:50:17 AM
|
Is this function OK for task4? void task3() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } Dataset dx(wks, 0); Dataset dy(wks, 1); Curve cr(dx,dy); double areay=area(cr); dy /= areay; }
//By the way, I give you the functions for task 4 and task 5. void task4() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } wks.AddCol(); Dataset dx(wks,0); Dataset dy(wks,1); Dataset dc(wks,2); dc=dx*dy; return; }
void task5() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } Dataset dx(wks,0); Dataset dc(wks,2); Curve cr(dx,dc); double areaC=area(cr); wks.AddCol(); wks.SetCell(0,3,areaC); return; }
Edited by - skelton on 06/07/2005 06:30:29 AM |
 |
|
ungat
Belgium
Posts |
Posted - 06/13/2005 : 08:48:59 AM
|
Hello Skelton, thank you very much; I am a beginner in Origin C compiling and I am not succeed in using your program; please could you complete this program for it becomes ready to work, because I don't know how to submit it.
Thank you very much again.
quote:
Is this function OK for task4? void task3() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } Dataset dx(wks, 0); Dataset dy(wks, 1); Curve cr(dx,dy); double areay=area(cr); dy /= areay; }
//By the way, I give you the functions for task 4 and task 5. void task4() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } wks.AddCol(); Dataset dx(wks,0); Dataset dy(wks,1); Dataset dc(wks,2); dc=dx*dy; return; }
void task5() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Active layer is not a worksheet!"); return; } Dataset dx(wks,0); Dataset dc(wks,2); Curve cr(dx,dc); double areaC=area(cr); wks.AddCol(); wks.SetCell(0,3,areaC); return; }
Edited by - skelton on 06/07/2005 06:30:29 AM
|
 |
|
|
Topic  |
|
|
|