Message Boards Message Boards

0
|
3876 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

What format for import and export of fractions?

Posted 10 years ago

I exported a long list of fractions to a .dat file using "Data". They import fine, but have a Head of List. I can't even use N[ ] on them. What format should I have used so the fractions are immediately usable?

POSTED BY: Douglas Youvan

This works, but it is a hack:

In[476]:= li = {3/2, 6/7, 1.02} Export["C:\Users\3000\Desktop\li.nb", li] li1 = Import["C:\Users\3000\Desktop\li.nb"] li1 N[li]

Out[476]= {3/2, 6/7, 1.02}

Out[477]= "C:\Users\3000\Desktop\li.nb"

Out[478]= Notebook[{Cell[ BoxData[RowBox[{"{", RowBox[{FractionBox["3", "2"], ",", FractionBox["6", "7"], ",", "1.02`"}], "}"}]], "Input"]}, FrontEndVersion -> "10.0 for Microsoft Windows (64-bit) (July 1, 2014)", StyleDefinitions -> "Default.nb"]

Out[479]= Notebook[{Cell[ BoxData[RowBox[{"{", RowBox[{FractionBox["3", "2"], ",", FractionBox["6", "7"], ",", "1.02`"}], "}"}]], "Input"]}, FrontEndVersion -> "10.0 for Microsoft Windows (64-bit) (July 1, 2014)", StyleDefinitions -> "Default.nb"]

Out[480]= {1.5, 0.857143, 1.02}

POSTED BY: Douglas Youvan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract