Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: a trivial task?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131115] Re: a trivial task?
  • From: Helen Read <readhpr at gmail.com>
  • Date: Wed, 12 Jun 2013 05:39:12 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <kp6fm8$nct$1@smc.vnet.net>

First, fix the unmatched quotes in the last part of exp.

exp = {"I do not", "understand", "this"}

Use Riffle to insert a linebreak in between each part, and then use 
StringJoin to combine into a single string.

withbreaks=Riffle[exp, "\n"]

text=StringJoin[withbreaks]

Export["filename.txt", text]

I like to use SetDirectory[NotebookDirectory[]]
before importing/exporting, so that the directory is the same place 
where the working notebook is saved.


On 6/11/2013 2:22 AM, Francisco Gutierrez wrote:
> Friends:
>
> Suppose I have a string variable, say:exp={"I do not", "understand", this"}
> I want to export this variable to a text file, so that each part of exp is separated by a line (\n). Thus I want to get:I do notunderstandthis
>
> How can I achieve this? Thanks
>
> Francisco
>
>






  • Prev by Date: Re: problems with FrameTicks
  • Next by Date: Re: problems with FrameTicks
  • Previous by thread: Re: a trivial task?
  • Next by thread: Re: Re: a trivial task?