2.2.4.48.2 XYRange::GetDatasetNamesGetDatasetNames
Description
Get dataset names of XYRange
Syntax
BOOL GetDatasetNames( string & strY, string & strX = NULL, string & strYErr = NULL, int nIndex = 0 )
Parameters
- strY
- [output]Dependent dataset name
- strX
- [output]Independent dataset name
- strYErr
- [output]YErr dataset name if exists
- nIndex
- [input]The data index
Return
Examples
EX1
//Do Subtraction between XYRange yi and XYRange yi2, then output the result to XYRange yo.
bool XYRange_GetDatasetNames_Prepare(const XYRange& yi, const XYRange& yi2, XYRange& yo)
{
string strX, strY;
if(!yi.GetDatasetNames(strY, strX))
return error_report("failed getting 1st XY input");
Curve cy1(strX, strY);
if(!yi2.GetDatasetNames(strY, strX))
return error_report("failed getting 2nd XY input");
Curve cy2(strX, strY);
if(!yo.GetDatasetNames(strY, strX))
return error_report("failed getting XY output");
Curve cyo(strX, strY);
if(cy1 && cy2 && cyo)
{
cyo = cy1 - cy2;
}
else
return error_report("not all curves constructed successfully.");
return true;
}
//Assume there is Book1, Book1 have three sheets, each sheet has two columns.
//Output XY Range dr3 to sheet3.
void XYRange_GetDatasetNames_ex1()
{
WorksheetPage wksPage("Book1");
Worksheet wks1 = wksPage.Layers(0);
//Contruct 3 XY Ranges.
XYRange dr1;
dr1.Add(wks1, 0, "X");
dr1.Add(wks1, 1, "Y");
Worksheet wks2 = wksPage.Layers(1);
XYRange dr2;
dr2.Add(wks2, 0, "X");
dr2.Add(wks2, 1, "Y");
Worksheet wks3 = wksPage.Layers(2);
XYRange dr3;
dr3.Add(wks3, 0, "X");
dr3.Add(wks3, 1, "Y");
//Do subtraction
XYRange_GetDatasetNames_Prepare(dr1, dr2, dr3);
}
Remark
See Also
XYRange::GetDescription
Header to Include
origin.h
|