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
 All Forums
 Origin Forum
 Origin Forum
 How to import many txt files to matrices?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
lihao1978 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.
2   L A T E S T    R E P L I E S    (Newest First)
lihao1978 Posted - 10/25/2007 : 11:14:40 AM
Mike, thank you so much. It really does work well!
Mike Buess 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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000