Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Trouble importing txt files

Subject: Trouble importing txt files

From: Florian

Date: 17 Aug, 2007 08:38:55

Message: 1 of 3

Sometimes I've big troubles improting *.txt files.

Normally I use the uiimport to import a file and generate
the variables in the workspace I need.

I'm using an textfile with the structure

+0.0001042 -0.005223
+0.000125 -0.003095
+0.0001458 +0.007835
+0.0001667 -0.001064
+0.0001875 +0.02234
+0.0002083 +0.01422
+0.0002292 +0.004159
+0.00025 +0.01606
+0.0002708 +0.01219
+0.0002917 +0.007545
+0.0003125 +0.02186
+0.0003333 +0.02302
+0.0003542 +0.02002

but something is wrong with the format. If I use the
command A = TEXTREAD('01_2.txt')

I'm getting the response:
??? Trouble reading number from file (row 1, field 1) ==>
+0.0001042 -0.005223 \n

What's wrong with this files? How could I modify this files
to get them imported into matlab?

Thank you

Florian

Subject: Re: Trouble importing txt files

From: us

Date: 17 Aug, 2007 08:53:17

Message: 2 of 3

Florian:
<SNIP <textread> headache...

> ??? Trouble reading number from file (row 1, field 1) ==>
> +0.0001042 -0.005223 \n
> What's wrong with this files?...

it seems that you have some extra chars at the end of your
text file, which may be due to the UNIX->DOS text mode
incompatibility (CR, LF)...
- do you copy/ftp your files from one OS to the other?

just a thought
us

Subject: Re: Trouble importing txt files

From: Florian

Date: 17 Aug, 2007 09:21:22

Message: 3 of 3

"us " <us@neurol.unizh.ch> wrote in message
<fa3nlt$5pj$1@fred.mathworks.com>...
> Florian:
> <SNIP <textread> headache...
>
> > ??? Trouble reading number from file (row 1, field 1)
==>
> > +0.0001042 -0.005223 \n
> > What's wrong with this files?...
>
> it seems that you have some extra chars at the end of
your
> text file, which may be due to the UNIX->DOS text mode
> incompatibility (CR, LF)...
> - do you copy/ftp your files from one OS to the other?
>
> just a thought
> us

Florian:

You're right. I made a copy from the measurement system to
my Laptop.

Do you know an solution for fixing such a file?

with best regards

Florian


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
txt Florian 17 Aug, 2007 05:25:06
txt format Florian 17 Aug, 2007 04:40:08
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics