Group Abstract Group Abstract

Message Boards Message Boards

Export string form correctly to excel?

Posted 6 years ago

Hello. I need to export all values of giant list to excel with string form. So I use this code

a = Table[
    Table[StringForm["strf``(``)=``", j, i - 1, b[[j]][[i]]], {i, 1, 
      10}], {j, 1, 1}] // Flatten // MatrixForm
Export["sf.xlsx", a]

And I get this output in mathematica strf1(0)=4.605170185988092 strf1(1)=6.638352067993813 strf1(2)=8.405946914885465 strf1(3)=10.045117514831617 strf1(4)=11.60462557947718 strf1(5)=13.108483652767925 strf1(6)=14.570618870336398 strf1(7)=15.99996345440759 strf1(8)=17.402652867352536 strf1(9)=18.783117393312526 But for excel I have this StringForm["strf()=", 1, 0, 4.605170185988092] StringForm["strf()=", 1, 1, 6.638352067993813] StringForm["strf()=", 1, 2, 8.405946914885465] StringForm["strf()=", 1, 3, 10.045117514831617] StringForm["strf()=", 1, 4, 11.60462557947718] StringForm["strf()=", 1, 5, 13.108483652767925] StringForm["strf()=", 1, 6, 14.570618870336398] StringForm["strf()=", 1, 7, 15.99996345440759] StringForm["strf()=", 1, 8, 17.402652867352536] StringForm["strf()=", 1, 9, 18.783117393312526] How to get the export file the same as the output from mathematica? Regards, Alex

POSTED BY: Alex Graham

Hey Alex, you can do

a = Table[Table["strf" <> ToString@j <> "(" <> ToString[i - 1] <> ")=" <> ToString@b[[j]][[i]], {i, 1, 10}], {j, 1, 1}] // Flatten 

The result is:

xlsx file result

I hope that it works.

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