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 for Programming
 LabTalk Forum
 multiple data file import

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
ringman7677 Posted - 01/15/2004 : 3:49:10 PM
I have ten (10 or more) separate ASCII data files that I want to merge into one worksheet (new rows). The trick is I need to adjust the first value in each column of the imported file to match up with the last value in the main worksheet file. This 'offset' would be applied to every value in the column. This same proceedure needs to be done with the next imported file and so on. I will admit I am not very proficient in script writing so any help would be greatly appreciated.
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 01/15/2004 : 8:57:48 PM
There are several ways to do that, but some of them depend on your Origin version. Since you didn't tell us that I'll suggest a method that should work in nearly any version. I must make two assumptions...

> Each file has the same number of rows (and columns, of course).
> By 'match up' you mean 'equal'.

If those assumptions are valid you can do this...

1. Create a new worksheet and select File->Import->Multiple ASCII.
2. In the file dialog choose Import each file as New Rows.
3. Select your data files and OK.

That will append all of your files as new rows to the same worksheet. The offsets can be introduced with the following LabTalk script...
nFiles=fdlog.multiopen.count; // # of files
get col(1) -e totalRows; // total # of rows
blockRows=totalRows/nFiles; // # rows per file
temp=data(1,blockRows); // create temporary data set
for(i=1;i<nFiles;i++) {
j1=i*blockRows; // final row index of the ith block
j2=j1+1; // first row index of next block
loop(k,1,wks.ncols) {
copy -b j2 wcol(k) temp -b 1 -t blockRows; // copy block to temp
temp = temp - temp[1] + wcol(k)[j1]; // offset temp
copy -b 1 temp wcol(k) -b j2 -t blockRows; // copy temp back to worksheet
};
};
del temp; // delete temporary data set


Mike Buess
Origin WebRing Member

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