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
 Origin Forum
 IMPORTING MULTIPLE ASCII
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

PF

France
Posts

Posted - 01/16/2007 :  1:50:29 PM  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 2000 Pro

Hello,

I'd like to import Multiple ASCII in a worksheet, do a bunch of operation and have them plotted. As I've never experienced OriginC programming, I'm quite lost with what I've seen on the forum.... so some tips would be of a great help...

Each ASCII file is composed by three columns. The first one is useless. The second one is composed of the x values. The third one is composed of the y values of a 2D graph.
The values of the second column of each files are the same (the x values don't change in a set of experiment). However, I need to do a calculation on the datas of the second column (Constant/col(2)), set it as X in the worksheet, and set the datas as ascending.
Once this is done, I need to plot the M third columns of the M files I'm treating on the same graph.

Another question is that I cannot find how to select by default 'import each files as' "New Columns" when using the 'Import Multiple Ascii' menu. Have you got a clue?

Thanks very much, Hope I was quite clear...

PF

Mike Buess

USA
3037 Posts

Posted - 01/16/2007 :  10:24:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The function below imports the 2nd (X) and 3rd (Y) columns from the first file but only the Y column from the rest. Add it to your workspace as described here and execute from the script window... import_test dConstant where dConstant is the constant for the X column.
void import_test(double dConstant = 1.0)
{
StringArray sa;
int iCount = GetMultiOpenBox(sa, FDLOG_ASCII, NULL, NULL, NULL, false);
if( !iCount ) return;
Worksheet wks;
wks.Create(); // create wks
ASCIMP ascimp; // ASCII options
wks.GetASCIMP(ascimp);
ascimp.iPartial = ASCIMP_PARTIAL_YES;
ascimp.iPartialC2 = 2; // stop at col 2;
ascimp.iMode = 1; // import as New Wks(0), New Columns (1), New Rows (2)
char chPath[MAX_PATH];
for(int ii=0; ii<iCount; ii++)
{

ascimp.iPartialC1 = ii==0 ? 1 : 2; // start at col ii
wks.SetASCIMP(ascimp);
wks.ImportASCII(sa[ii], ascimp);
wks.Columns(ii + 1).SetLabel(GetFileName(sa[ii]));
}
wks.ShowLabels();
wks.Columns(0).SetType(OKDATAOBJ_DESIGNATION_X); // set 1st col as X
wks.Sort(SORT_DESCENDING);
Dataset ds(wks,0);
ds = dConstant / ds;
GraphPage gp;
gp.Create();
gp.Layers(0).AddPlot(wks); // plot all Y cols
gp.LT_execute("legend");
}
quote:
Another question is that I cannot find how to select by default 'import each files as' "New Columns" when using the 'Import Multiple Ascii' menu.
Use the drop-down list at the center of the dialog. Note that there will be no import option in the dialog created by import_test for which the option is set by ascimp.iMode.



Mike Buess
Origin WebRing Member
Go to Top of Page

zachary_origin

China
Posts

Posted - 01/17/2007 :  12:29:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi PF,

As for the second question, I think you are saying to make "New Columns" as default for the "Import Multiple ASCII" dialog everytime you open it, right?

If it is, you can open FILE.OGS under your Origin installation folder, find section [MultiImportWKS] and add line
FDLOG.multiopen.ComboSel=2;
after the line
FDLOG.MultiOpen.ComboList$=$File.WKSImportAsComboList;

Save the file and reopen the dialog, you can see the effect.


Zachary
OriginLab Technical Services.
Go to Top of Page

PF

France
Posts

Posted - 01/17/2007 :  05:31:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much to both of you, everything's perfect now! I might be able to finish my work just in time!!!

Cheers, Bye
Go to Top of Page

a.abc.b35

175 Posts

Posted - 01/08/2011 :  10:17:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you a lot

AB
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