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
 array of curves
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ovince

Yugoslavia
Posts

Posted - 10/30/2006 :  02:21:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi,


I realise that it is possible to define something like this

Database db[10];

I have tried the same with curves. It compiles but have a problem when executing the code. Basically, this is the idea



//define curve array
Curve crv[10];


int j = 0;
foreach (PageBase pb in Project.Pages)
{
.....

////copy datasets to curve
Curve crvCopy( Dn, HdA ); //Dn and HdA are datasets
crv[j]=crvCopy;

.....

j++;
}

//PLOTTING PART

for (int k=0; k<10; k++)
{

Curve tmpC;
tmpC=crv[k];

int kk = gly.AddPlot( tmpC, IDM_PLOT_SCATTER );
DataPlot dpLine = gly.DataPlots(kk);

gly.Rescale();
}




Why it does not work?

oliver

Deanna

China
Posts

Posted - 10/30/2006 :  03:58:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The main problem is that you cannot copy a curve like
crv[j]=crvCopy

Actually, I don't think you really need a curve array. You may just need two string arrays to save the names of Dn and HdA.

I suggest that you can do it in the following way:


//define string arrays
string DnString[2];
string HdAString[2];

int j = 0;
foreach (PageBase pb in Project.Pages)
{
.....

//copy dataset names
DnString[j] = Dn.GetName();
HdAString[j] = HdA.GetName();

.....

j++;
}


//plotting part
for (int k=0; k<10; k++)
{
Curve tmpC(DnString[k], HdAString[k]);

int kk = gly.AddPlot( tmpC, IDM_PLOT_SCATTER );
DataPlot dpLine = gly.DataPlots(kk);

gly.Rescale();
}


Deanna
OriginLab Technical Services
Go to Top of Page

ovince

Yugoslavia
Posts

Posted - 10/30/2006 :  05:06:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
yes, it is a good idea


thanks Deanna, Mike and Zachary for helping me in a last few days
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