Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9151

Re: Export Data and Decimal Separator

From Rodrigo Murta <murta@rodrigomurta.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Export Data and Decimal Separator
Date 2012-03-19 10:03 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jk7095$11t$1@smc.vnet.net> (permalink)
References <jjrvbg$9h3$1@smc.vnet.net> <jjv8gt$phc$1@smc.vnet.net>

Show all headers | View raw


Hi Murray,
I tried you suggestion, but with negative result. There it is:

first test
conv[n_] := NumberForm[n, NumberPoint -> ","];
data = {{1.1, 1.2}, {2.1, 2.2}};
conv /@ data
I Get this that is ok!
{{1,1,1,2},{2,1,2,2}}

when I try to export using:
Export["~/Desktop/file.txt", conv /@ data, "TSV"]

I get this as the file content
NumberForm[{1.1,1.2},NumberPoint->","]
NumberForm[{2.1,2.2},NumberPoint->","]

some clue?
tks in advance
Murta

On Mar 18, 4:55 am, Murray Eisenberg <mur...@math.umass.edu> wrote:
> How about using NumberForm and its option NumberPoint?
>
> (Sorry, I don't have the original post).
>
> On 3/17/12 3:52 AM, Norbert Marxer wrote:
>
>
>
>
>
>
>
>
>
> > On 16 Mrz., 12:34, Murta<rodrigomur...@gmail.com>  wrote:
> >> Hi Bill, tks for your reply.
> >> I need comma for number decimal separator(10,1 instead of 10.1), your
> >> sugestion is for field separator.
> >> For Import command it works nice.
> >> Some idea?
>
> >> On Mar 15, 2:40 am, Bill Rowe<readn...@sbcglobal.net>  wrote:
>
> >>> On 3/14/12 at 12:36 AM, rodrigomur...@gmail.com (Murta) wrote:
>
> >>>> I would like to know how could I export some data using comma as
> >>>> decimal separator.
> >>>> I tried this: data={{1.3,2.3},{3.2,4.3}} Export["file.txt", data,
> >>>> "TSV", {NumberPoint ->  ","}]
> >>>> But didn't worked. Some idea?
>
> >>> "TSV" = tab separated values
> >>> "CSV" = comma separated values
>
> >>> Try that instead. That is
>
> >>> Export["file.txt", data, "CSV"]
>
> > Hello
>
> > You could define a function which converts your number to a string,
> > replaces the points with a comma, and maps this to all the numbers of
> > your table:
>
> > mod := Map[StringReplace[ToString[ #], "." ->  ","]&, #, {2}]&;
>
> > You can test this with:
>
> > data = {{1.3, 2.3}, {3.2, 4.3}};
> > ExportString [mod[data], "TSV"]  (*or*)
> > Export["test.txt", mod[data], "TSV"]
>
> > Best Regards
> > Norbert Marxer
>
> --
> Murray Eisenberg                     mur...@math.umas=
s.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (=
W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Export Data and Decimal Separator Bill Rowe <readnews@sbcglobal.net> - 2012-03-15 05:40 +0000
  Re: Export Data and Decimal Separator Murta <rodrigomurtax@gmail.com> - 2012-03-16 11:34 +0000
    Re: Export Data and Decimal Separator Norbert Marxer <marxer@mec.li> - 2012-03-17 07:55 +0000
      Re: Export Data and Decimal Separator Rodrigo Murta <murta@rodrigomurta.com> - 2012-03-19 10:04 +0000
    Re: Export Data and Decimal Separator Murray Eisenberg <murray@math.umass.edu> - 2012-03-18 07:55 +0000
    Re: Export Data and Decimal Separator Rodrigo Murta <murta@rodrigomurta.com> - 2012-03-19 10:03 +0000

csiph-web