Author |
Topic |
|
lihao1978
USA
Posts |
Posted - 10/23/2007 : 6:21:18 PM
|
Origin Version (Select Help-->About Origin): 75sr6 Operating System:XPsp2
I have a lot of txt files need to be imported into matrices respectively. It is boring to import one by one by using the "Import ASCII..." especially when the file is large. Does anyone know how to import all the files one time? Or, I can import all the files into worksheets one time. But, who can help me to convert many worksheets into matrices efficiently? Thanks. |
|
Mike Buess
USA
3037 Posts |
Posted - 10/24/2007 : 10:43:56 PM
|
If you can import a single file directly to matrix with the Import ASCII menu command then the following script will do the same from a multiple file selection dialog. You can run the script from the script window or Custom Routine button.
fdlog.UseGroup(Ascii); // use extensions .csv, .dat, .txt, .* if( fdlog.MultiOpen()==0/0 ) break; // quit if dialog was cancelled loop(ii, 1, fdlog.MultiOpen.Count) { fdlog.Get(A, ii); // set %A = next file name win -t matrix; // create new matrix open -w %A; // import file to matrix set_ascii_import_page_info(%A); // save file name, path and date matrix -pg Dim nCols nRows; // get # columns and rows matrix -ps X 1 nCols; // set X range = 1 to nCols matrix -ps Y 1 nRows; // set Y range = 1 to nRows }
Mike Buess Origin WebRing Member |
|
|
lihao1978
USA
Posts |
Posted - 10/25/2007 : 11:14:40 AM
|
Mike, thank you so much. It really does work well! |
|
|
|
Topic |
|
|
|