| Author |
Topic  |
|
|
rafaelenr
Ireland
Posts |
Posted - 05/14/2008 : 06:50:51 AM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System: windows xp
I started to use origin c a couple of days ago to try to automate some work. I wrote a code that imports an ascii file and create some columns in the worksheet, but when I try to set the column values everything works find to the row number 30th (my worksheet has 173 rows), when I get the following error: "Origin C Function Runtime Error, general operation failure"
The code I wrote is as follows:
void main() { simple_import(); del_col(); insert_col(); Worksheet wks = Project.ActiveLayer(); int /*nRow = wks.GetNumRows(),*/ i; Dataset angle_corr( wks, 0 ), angle ( wks, 9 ), u1v ( wks, 2 ), rho ( wks, 3 ), curr (wks, 1 ); angle.Trim(); int nRow = angle.GetSize(); printf("there is %d components\n",nRow);//fflush(stdout); //we correct the angle for(i=0 ; i < nRow; i++) { angle_corr[i] = 360 - angle[i]; } }
anybody can tell me how to solve this? thanks,
Rafa |
|
|
5*10
Germany
Posts |
Posted - 05/21/2008 : 09:51:39 AM
|
Hi,
try to set the dimension of the Dataset in this way:
void main() { simple_import(); del_col(); insert_col(); Worksheet wks = Project.ActiveLayer(); int i; Dataset angle_corr( wks, 0 ), angle ( wks, 9 ), u1v ( wks, 2 ), rho ( wks, 3 ), curr (wks, 1 ); int nRow = angle.GetSize();
angle_corr.SetSize(nRow); angle.SetSize(nRow); u1v.SetSize(nRow); rho.SetSize(nRow); curr.SetSize(nRow); angle.Trim();
printf("there is %d components\n",nRow);//fflush(stdout);
//we correct the angle for(i=0 ; i < nRow; i++) { angle_corr[i] = 360 - angle[i]; } }
Good luck.
5*10
|
 |
|
| |
Topic  |
|
|
|