<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258400</link>
    <title>MATLAB Central Newsreader - can not read float numbers from a txt file.</title>
    <description>Feed for thread: can not read float numbers from a txt file.</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 13 Aug 2009 09:25:17 -0400</pubDate>
      <title>can not read float numbers from a txt file.</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258400#672740</link>
      <author>Leblead Sweid</author>
      <description>Hi everybody,&lt;br&gt;
&lt;br&gt;
i am trying to read float numbers from a text file, but it worked only if i assume the float numbers as string .To be more clear, i have tried that:&lt;br&gt;
&lt;br&gt;
data=textscan(fid,'%*s%s%s%s%s%s%s%s%s%s%s%s%s%s','delimiter', ';')&lt;br&gt;
&lt;br&gt;
to read that file &lt;br&gt;
&lt;br&gt;
00:00:19,968;8,02;8,44;8,30;7,79;8,19;7,96;9,80;9,44;15,42;16,35;13,40;13,19;8,16;&lt;br&gt;
00:00:19,972;8,00;8,49;8,35;7,86;8,24;7,85;9,72;9,33;15,01;16,04;13,41;13,43;8,05;&lt;br&gt;
00:00:19,976;7,91;8,40;8,18;7,89;8,13;7,96;9,78;9,49;15,14;16,36;13,41;13,31;8,02;&lt;br&gt;
00:00:19,980;7,95;8,45;8,29;7,84;8,19;8,02;9,92;9,53;15,00;16,49;13,28;13,34;8,26;&lt;br&gt;
&lt;br&gt;
so when i used:&lt;br&gt;
&lt;br&gt;
data=textscan(fid,'%n%n%n%n%n%n%n%n%n%n%n%n%n%n','delimiter', ';')&lt;br&gt;
&lt;br&gt;
i got only two arrays instead of 14 arrays and in the two arrays there are only numbers with nothing after the comma.&lt;br&gt;
&lt;br&gt;
thanks .</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 10:40:25 -0400</pubDate>
      <title>Re: can not read float numbers from a txt file.</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258400#672758</link>
      <author>Rune Allnor</author>
      <description>On 13 Aug, 11:25, &quot;Leblead Sweid&quot; &amp;lt;bhann...@live.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi everybody,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; i am trying to read float numbers from a text file, but it worked only if i assume the float numbers as string .To be more clear, i have tried that:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; data=textscan(fid,'%*s%s%s%s%s%s%s%s%s%s%s%s%s%s','delimiter', ';')&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; to read that file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 00:00:19,968;8,02;8,44;8,30;7,79;8,19;7,96;9,80;9,44;15,42;16,35;13,40;13,1&#173;9;8,16;&lt;br&gt;
&lt;br&gt;
You are using a locale where the decimal mark is comma&lt;br&gt;
rather than dot. You need to change this before you&lt;br&gt;
attempt to convert from text to numbers.&lt;br&gt;
&lt;br&gt;
If you read the lines from the file yourself (as opposed&lt;br&gt;
to using some canned routine), use&lt;br&gt;
&lt;br&gt;
s = sttrep(s,',','.');&lt;br&gt;
&lt;br&gt;
You might also have a problem with the penultimate column,&lt;br&gt;
which contains 13,1-9. It is not at all obvious that this&lt;br&gt;
will be accepted, or if so, converted correctly:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; sscanf('13.1-9','%f')&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;13.1000&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-9.0000&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; str2num('13.1-9')&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4.1000&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 10:41:51 -0400</pubDate>
      <title>Re: can not read float numbers from a txt file.</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258400#672759</link>
      <author>Rune Allnor</author>
      <description>On 13 Aug, 12:40, Rune Allnor &amp;lt;all...@tele.ntnu.no&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; 00:00:19,968;8,02;8,44;8,30;7,79;8,19;7,96;9,80;9,44;15,42;16,35;13,40;13,1&#173;&#173;9;8,16;&lt;br&gt;
&lt;br&gt;
&amp;gt; You might also have a problem with the penultimate column,&lt;br&gt;
&amp;gt; which contains 13,1-9.&lt;br&gt;
&lt;br&gt;
Sorry, something bad happened when I cut'n pasted&lt;br&gt;
your data to matlab.&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 19:36:03 -0400</pubDate>
      <title>Re: can not read float numbers from a txt file.</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258400#673003</link>
      <author>Andres </author>
      <description>Hi,&lt;br&gt;
try&lt;br&gt;
&lt;br&gt;
data = txt2mat(filename.txt);&lt;br&gt;
&lt;br&gt;
with txt2mat from the file exchange ( &lt;a href=&quot;http://www.mathworks.de/matlabcentral/fileexchange/18430&quot;&gt;http://www.mathworks.de/matlabcentral/fileexchange/18430&lt;/a&gt; ).</description>
    </item>
  </channel>
</rss>

