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
 import ASCII -> create wks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

prgo

Posts

Posted - 12/01/2006 :  09:17:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.0
Operating System:WinXP

this is a problem (at least for me):
i want to import a few "n" ASCII files,
and to put them in "n" wks,
with names "data/i" where i goes from 1 to n.

because, for the rest of the function i need that "n" as a number,
and wks-s names!

is it possible to make some loop to recognize the number of imported files, and generate the names?

prgo

Mike Buess

USA
3037 Posts

Posted - 12/01/2006 :  11:19:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi prgo,

Are you importing via File > Import > Multiple ASCII or a custom Origin C function? If the latter please show us what you have so far. Also, what are "wks-s names"?

Mike Buess
Origin WebRing Member
Go to Top of Page

prgo

Posts

Posted - 12/01/2006 :  11:33:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
File>Import>ASCII Options...
with that i get dataset with the name of the original file name
i would like to make it more general, so when i import for example 5 different datasets, then my script should recognize that i have 5 different wks, and give them generic names from data1 to data5.

here is my very rough idea what should be in that script,
all these names i have to put "by hand" in OPJ...

void test ()

{

Worksheet wks1("correction");
Worksheet wks2("data1");
Worksheet wks3("data2");
Worksheet wks4("data3");
Worksheet wks5("data4");
Worksheet wks6("data5");

Worksheet wks7;
wks7.Create();
wks7.GetPage().Rename("Results");

Dataset dsColA(wks1,0);
Dataset dsColB(wks1,1);
Dataset dsColF(wks2,5);
Dataset dsColFF(wks3,5);
Dataset dsColFFF(wks4,5);
Dataset dsColFFFF(wks5,5);
Dataset dsColFFFFF(wks6,5);
Dataset dsColAA(wks7,0);
Dataset dsColBB(wks7,1);
if (wks7.Columns.Count()==2)wks7.AddCol();
Dataset dsColBC(wks7,2);
if (wks7.Columns.Count()==3)wks7.AddCol();
Dataset dsColBD(wks7,3);
if (wks7.Columns.Count()==4)wks7.AddCol();
Dataset dsColBE(wks7,4);
if (wks7.Columns.Count()==5)wks7.AddCol();
Dataset dsColBF(wks7,5);


dsColBB.SetSize(dsColF.GetSize());

dsColAA = dsColA;
dsColBB = dsColF * dsColB;
dsColBC = dsColFF * dsColB;
dsColBD = dsColFFF * dsColB;
dsColBE = dsColFFFF * dsColB;
dsColBF = dsColFFFFF * dsColB;


GraphPage gr;
string strTemplate = "template.otp";
BOOL bOK = gr.Create(strTemplate, CREATE_VISIBLE);

if (!bOK)
return;

GraphLayer grlay = gr.Layers(0);
ASSERT(grlay.IsValid());

int d = wks5.Columns.Count();
int ii = 1;

for (ii = 1; ii < d+1; ii++)
{
Curve cv(wks7,0,ii);

int nPlot = grlay.AddPlot(cv, IDM_PLOT_LINE);
if (nPlot >= 0)
grlay.DataPlots(nPlot).SetColor(ii, TRUE);
grlay.Rescale();

}

}


Go to Top of Page

zachary_origin

China
Posts

Posted - 12/01/2006 :  12:23:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

void testWks()
{

string strDataWks;
Worksheet wksCorr("correction");

Worksheet wksRes;
wksRes.Create();
wksRes.GetPage().Rename("Results");
while(wksRes.Columns.Count()<7)wksRes.AddCol();

Dataset dsColA(wksCorr,0);
Dataset dsColB(wksCorr,1);
Dataset dsColAA(wksRes,0);

dsColAA=dsColA;

for (int ii=2; ii<=6; ii++)
{
strDataWks.Format("data%d",ii);
Worksheet wks(strDataWks);
Dataset dsColF(wks, 5);
Dataset dsColBi(wks,ii-1);
dsColBi = dsColF*dsColB;
}

}


Zachary
OriginLab Technical Services.
Go to Top of Page

prgo

Posts

Posted - 12/02/2006 :  5:57:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks,thanks!!!!
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