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 for Programming
 Forum for Origin C
 set colum values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rafaelenr

Ireland
Posts

Posted - 05/14/2008 :  06:50:51 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 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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

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