Update
Update an Origin C Curve object from an Origin data set or vice-versa.
void Update( BOOL bFromOrigin, int mode = -1 )
EX1
//Book1 worksheet with column A must exist prior to execution void curvebase_Update_ex1() { string dsName = "Book1_A"; Curve crv(dsName); LT_execute("set Book1_A -e 20;Book1_A=2;"); // Note Curve crv size is not updated in Local Variables windows of Debug mode crv.Update(TRUE); }
EX2
//Book1 worksheet with column B must exist prior to execution // This example shows how to update Origin from inside Origin C program before it returns int curvebase_Update_ex2(string dsName = "Book1_B") { Curve crv(dsName); // in case column is empty if(crv.GetSize()<1) { crv.SetSize(10); crv=0; } crv[0]+=1; crv.Update(FALSE, REDRAW_REFRESH); MessageBox(GetWindow(),"Book1_B increment 1, click OK to increment again"); crv[0]+=1; return 0; }
EX3
// Demonstrate the usage of REDRAW_REALTIME_SCOPE and REDRAW_REALTIME_WKS // Assumes: // 1) Book1_A is filled with row numbers // 2) Book1_A(X) vs. Book1_B(Y) is plotted as line plot // 3) The line plot is set to animate mode so that the effect is fully visualized // (set plot active and then execute LabTalk script command "set %C -an 1") int curvebase_Update_ex3(string dsName = "Book1_B", int imax = 20) { Curve crv(dsName); if(crv.IsValid()) { int nMaxRows = 10; if(crv.GetSize() < nMaxRows) { crv.SetSize(nMaxRows); crv=0; } int ic = 0;//current cell for(int ii = 0; ii < imax; ii++) { for(int jj = 0; jj < nMaxRows; jj++) crv[jj] = 1; crv[ic++] = 2; if(ic >= nMaxRows) ic = 0; //crv.Update(FALSE, REDRAW_REALTIME_WKS); crv.Update(FALSE, REDRAW_REALTIME_SCOPE); LT_execute("sec -w 0.1;");// hard wait } return 0; } else return 1; }
Update an Origin C Dataset object from an Origin dataset or update an Origin dataset from an Origin C Dataset object. The number of elements and memory allocated are primarily affected by this method.
curvebase::Append
origin.h