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
 Data() function fail?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dharmarasu2

Japan
3 Posts

Posted - 03/11/2004 :  04:14:03 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

why does the Data(xmin, xmax, inc) function fail in my following orign C code??

Dataset newX, newY;
newX.Data(xmin, xmax, inc);

I want the newX dataset to be filled with the minimum(xmin) to maximum(xmax) values with the increments defined by "inc" .

Or is it necessary to use the LabTalk script instead of the orgin C Data function here?


Cheers,
Dharmarasu

cpyang

USA
1406 Posts

Posted - 03/11/2004 :  05:14:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dataset must be attached to a real column in Origin, so you should use vector instead,


vector newx;

newx.Data(xmin, xmax, inc);



To use Dataset, then you need to, for example



Worksheet wks = Project.ActiveLayer();
if(wks.GetNumCols() < 2)
wks.SetSize(30,2);

Dataset newX(wks,0); // col(A)
Dataset newY(wks,1); // col(B)

newX.Data(xmin, xmax, inc);


CP


Go to Top of Page

dharmarasu2

Japan
3 Posts

Posted - 03/11/2004 :  5:07:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thankyou. That did the Job!!

dharmarasu


quote:

Dataset must be attached to a real column in Origin, so you should use vector instead,


vector newx;

newx.Data(xmin, xmax, inc);



To use Dataset, then you need to, for example



Worksheet wks = Project.ActiveLayer();
if(wks.GetNumCols() < 2)
wks.SetSize(30,2);

Dataset newX(wks,0); // col(A)
Dataset newY(wks,1); // col(B)

newX.Data(xmin, xmax, inc);


CP




Go to Top of Page

cjbf

UK
8 Posts

Posted - 11/13/2008 :  10:54:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I've found what may be a bug in Origin 8 SR4, which seemed not to be a problem some time in the past:
The compiler gives the error "Error, calling function Dataset::Data has too many matches in declaration" if the vector or dataset is not integer type, when the increment is omitted (and hence defaults to the integer value 1). Specifying the increment as 1. fixes the error.

vector<double> newx;
newx.Data(0., 10,1.); //works
newx.Data(0., 10); // gives compile error

Hope that helps,
Chris.
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