|
|
read multiple text files to one file
Hello,
I am trying to read multiple text files with different names and write them to a single file. I have several n x 3 text files (n varies across files), and would like to read all these files and combine their columns into one m x 3 text file (m is the number of data points from all the files).
Also, how can I perform a paired t-test on specific columns of text files situated in different directories ?
Thanks !
|
|
0
|
|
|
|
Reply
|
Brian
|
4/13/2010 1:42:03 AM |
|
On Apr 13, 1:42=A0pm, "Brian " <brianb...@gmail.com> wrote:
> Hello,
>
> I am trying to read multiple text files with different names and write th=
em to a single file. I have =A0several =A0n x 3 text files (n varies across=
files), and would like to read all these files and combine their columns i=
nto one m x 3 text file (m is the number of data points from all the files)=
..
>
> Also, how can I perform a paired t-test on specific columns of text files=
situated in different directories ?
>
> Thanks !
So, what have you done so far in respect of reading these files?
|
|
0
|
|
|
|
Reply
|
TideMan
|
4/13/2010 2:27:57 AM
|
|
For the reading & combining of the text files part, you can use
fgetl().
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
4/13/2010 2:34:08 AM
|
|
TideMan <mulgor@gmail.com> wrote in message <ea4c60bb-0ebe-45db-ad01-978e4cc47644@x3g2000yqd.googlegroups.com>...
> On Apr 13, 1:42 pm, "Brian " <brianb...@gmail.com> wrote:
> > Hello,
> >
> > I am trying to read multiple text files with different names and write them to a single file. I have several n x 3 text files (n varies across files), and would like to read all these files and combine their columns into one m x 3 text file (m is the number of data points from all the files).
> >
> > Also, how can I perform a paired t-test on specific columns of text files situated in different directories ?
> >
> > Thanks !
>
> So, what have you done so far in respect of reading these files?
This is what I have so far, and looking for the most efficient way to write the data from
all these files to a single file:
files_int = dir('*.txt');
for k = 1:length(files_int)
filename = files_int(k).name;
output1 = read(filename);
end
|
|
0
|
|
|
|
Reply
|
Brian
|
4/13/2010 10:34:23 AM
|
|
Come on Brian, you can do better than that. Seriously, how is read()
going to write a file???? And where is any kind of a write
statement???? This is all you could accomplish on your own so far?
Like I said before you can use fgetl() to fetch lines from the files,
then use fprintf() to write those lines out to a single output file.
You'll also need fopen and fclose of course. I believe the help has
examples for all these functions.
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
4/13/2010 10:44:23 AM
|
|
|
4 Replies
757 Views
(page loaded in 0.067 seconds)
Similiar Articles: I want to read only a few lines from multiple text files - comp ...Suppose I have multiple text files in a directory, and I want to read only a few lines from each and then skip the rest of the text file and move on... concatenating multiple text files into one text file - comp.soft ...awk script to split text file content to multiple files - comp ..... file to another as a new column - comp.lang.awk ... read multiple text files to one file ... ... and ... reading text files - comp.soft-sys.sasread multiple text files to one file - comp.soft-sys.matlab ... Hello, I am trying to read multiple text files with different names and write them to a single file. PROC IMPORT for multiple txt files - comp.soft-sys.sasPROC IMPORT for multiple txt files - comp.soft-sys.sas PROC IMPORT for multiple txt files - comp.soft-sys.sas read multiple text files to one file - comp ... Shortest way to read all lines (one by one) from a text file ...read multiple text files to one file - comp.soft-sys.matlab ... Shortest way to read all lines (one by one) from a text file ... Ok, I know in general a way to read text ... read and merge lots of txt files, macro? - comp.soft-sys.sas ...1000+ txt files. two types. Type one file contains a list of ... I want to read only a few lines from multiple text files - comp ... Reading TXT file into MSAccess using ... Write sequence text files within a loop - comp.soft-sys.matlab ...read multiple text files to one file - comp.soft-sys.matlab ... Hello, I am trying to read multiple text files with different names and write them to a single ... read ... Read file twice and modify content - comp.lang.awkI want to read only a few lines from multiple text files - comp ... Read file twice and modify content - comp.lang.awk Hello, I want to modify content of multiple files. ... Converter for multiple (!!) *.html files to one (!!) *.pdf or ...Assume I have downloaded a couple of related html web pages with (locally transformed) links between them. Now I want to put all these html source files into ONE ... load multiple files - comp.soft-sys.matlabSuppose I have multiple text files in a directory, and I want to read only a ... TXT file into ... So how can I read 1500 images one by one ... load multiple files - comp ... c# - How to read multiple text files and save them into one text ...In my case I have five huge text files,which I have to embedd into one text file. I tried with StreamReader(),but I don't know how to make it Read one more file,do I ... Read multiple text files - Microsoft Corporation: Software ...I have an app that reads from one to 15 text files and appends the records into one text file. I've put a ListBox on the form thinking I could step thru ... 7/21/2012 11:14:10 PM
|
|
|
|
|
|
|
|
|