<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239691</link>
    <title>MATLAB Central Newsreader - Decimal Separator</title>
    <description>Feed for thread: Decimal Separator</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>Fri, 21 Nov 2008 16:49:03 -0500</pubDate>
      <title>Decimal Separator</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239691#612414</link>
      <author>Ellen Arens</author>
      <description>How can I import numeric data that uses a comma as a decimal separator?  For example, a table of 640 by 480 numberic valves.</description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 20:47:02 -0500</pubDate>
      <title>Re: Decimal Separator</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239691#612484</link>
      <author>Andres </author>
      <description>&quot;Ellen Arens&quot; &amp;lt;ellen.e.arens@nasa.gov&amp;gt; wrote in message &amp;lt;gg6opu$1i2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; How can I import numeric data that uses a comma as a decimal separator?  For example, a table of 640 by 480 numberic valves.&lt;br&gt;
&lt;br&gt;
You want to import the table from an ascii file?&lt;br&gt;
Try out txt2mat from the matlab central file exchange. If the file structure is not too weird, just&lt;br&gt;
&lt;br&gt;
A=txt2mat('myfile.txt')&lt;br&gt;
&lt;br&gt;
will do.&lt;br&gt;
Hth&lt;br&gt;
Andres</description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 23:41:27 -0500</pubDate>
      <title>Re: Decimal Separator</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239691#612515</link>
      <author>Rune Allnor</author>
      <description>On 21 Nov, 17:49, &quot;Ellen Arens&quot; &amp;lt;ellen.e.ar...@nasa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt; How can I import numeric data that uses a comma as a decimal separator? =&lt;br&gt;
=A0For example, a table of 640 by 480 numberic valves.&lt;br&gt;
&lt;br&gt;
The general idea would be to read a full line, replace&lt;br&gt;
commas by dots and then convert to numbers. Something&lt;br&gt;
like (not tested!):&lt;br&gt;
&lt;br&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br&gt;
fid =3D fopen('file.txt');&lt;br&gt;
A =3D[];&lt;br&gt;
while(~feof(fid))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s =3D fgetl(fid);       % Read line from file&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cidx =3D find(s=3D=3D',');  % Find all commas...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s(cidx)=3D'.';          % ...and replace with dots&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a=3Dsscanf('%f',s,inf); % Read in as numbers&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A =3D [A;a'];           % Append to result matrix&lt;br&gt;
end&lt;br&gt;
fclose(fid);&lt;br&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
  </channel>
</rss>

