Re: Export to file

*To*: mathgroup at smc.vnet.net*Subject*: [mg50938] Re: Export to file*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Tue, 28 Sep 2004 00:59:10 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 9/27/04 at 12:42 AM, e_cysterna at wp.pl (CYSTERNA++) wrote: >I have parametric function sX[i], sY[i], sZ[i] and I want to export >coordinate of points to file. For each "i" from "0" to "100" I >calculate coordinates and print to file. (see below) >For[i = 0. i < 100 , i += 1, > PutAppend[ > StringJoin[ > ToString[sX[i]], > " ", > ToString[sY[i]], > " ", > ToString[sZ[i]]], > "C:/MyPoints.txt"] > ] >I have BIG problem, because of format of these numbers >(coordinates) My file looks like as follow : >"18.4568 44.6881 -2.47084" "19.8777 40.9391 1.23937" >but I need other format (whithout quotation marks) like below >18.4568 44.6881 -2.47084 19.8777 40.9391 1.23937 >How can I do this in Mathematica 4.0. Please Help me. Don't use ToString and StringJoin. You are getting quotes because you converted the results of the function to strings. If you re-write your code as follows: For[i = 0. i < 100 , i += 1, PutAppend[ {sX[i]," ",sY[i]," ",sZ[i]}, "C:/MyPoints.txt"] ] you should get what you want. But I think even better would be Export["C:/MyPoints.txt", Table[{sX[n],sY[n],sZ[n]},{n,0,100},"Table"] That is write out the completed array and let Export insert the appropriate spaces. This should give you better performance since it doesn't ask Mathematica to open and close the file repeatedly. OTOH, if it is taking a long time to compute each point and there is a risk of your system crashing before all of the results can be computed, saving each result as it becomes available will ensure you get a least a partial result if your system should crash. -- To reply via email subtract one hundred and four