From: dpb on
Rick T wrote:
> Greetings All
>
> I have matlab 7.6.0.324 (r2008a) I'm trying to export data as a text
> file that just has numbers and matlab keeps exporting it with scientific
> notation with e.
>
> this is the command I use to export the text file
> save c:\\testdata.txt exportFile -ascii
>
> I've changed the format to long, I've tried using fprintf('%9.9f
> \n',finalx); but when I look at the text file it's still in scientific
> notation
> example:
> 5.8494616e-004
>
> just trying to get this type of output in my text file
> .00058494616

>> x=5.8494616e-004;
>> sprintf('%f', x)
ans =
0.000585
>> sprintf('%14.9f', x)
ans =
0.000584946
>>

Oh, I forget, fprintf() w/o a fid will default to the console--let's see
there...

>> fprintf('%14.9f', x, x^2)
0.000584946 0.000000342
>>

Looks ok to me...

Note your '%9.9f' will stack multiple values on each other end-to-end
that will make parsing later troublesome at best...

--
From: sal2 on
On Tue, 08 Sep 2009 20:58:54 -0500, dpb wrote:

> Rick T wrote:
>> Greetings All
>>
>> I have matlab 7.6.0.324 (r2008a) I'm trying to export data as a text
>> file that just has numbers and matlab keeps exporting it with
>> scientific notation with e.
>>
>> this is the command I use to export the text file save c:\\testdata.txt
>> exportFile -ascii
>>
>> I've changed the format to long, I've tried using fprintf('%9.9f
>> \n',finalx); but when I look at the text file it's still in scientific
>> notation
>> example:
>> 5.8494616e-004
>>
>> just trying to get this type of output in my text file .00058494616
>
> >> x=5.8494616e-004;
> >> sprintf('%f', x)
> ans =
> 0.000585
> >> sprintf('%14.9f', x)
> ans =
> 0.000584946
> >>
> >>
> Oh, I forget, fprintf() w/o a fid will default to the console--let's see
> there...
>
> >> fprintf('%14.9f', x, x^2)
> 0.000584946 0.000000342
> >>
> >>
> Looks ok to me...
>
> Note your '%9.9f' will stack multiple values on each other end-to-end
> that will make parsing later troublesome at best...

Thanks :-)