m1 = {{"a",b},{c,d}};
nb = CreateDocument[];
NotebookWrite[nb, Cell[ToBoxes@Grid[m1],"Text"]]
The expression below gives the right result so there is something missing in my limited understanding of Cell expressions.
Grid@m1
Thanks
Robert
ShowStringCharacters->False
as an option to the Cell expression.
--David
On May 6, 5:25 am, robert prince-wright <robertprincewri...@yahoo.com>
wrote:
> Can someone show me how to write the list m1 to a notebook without the qu=
otes showing?
>
> m1 = {{"a",b},{c,d}};
> nb = CreateDocument[];
> NotebookWrite[nb, Cell[ToBoxes@Grid[m1],"Text"]]
>
> The expression below gives the right result so there is something missing=
That has nothing to do with the convertion to boxes but is controlled by
Cell properties. There are two ways to achieve what you want:
1) use cells of style "Output", which will by default not show the
string characters (which is why you don't see them with Grid@m1):
NotebookWrite[nb, Cell[BoxData[ToBoxes@Grid[m1]], "Output"]]
2) stay with the "Text" style cells, but change the settings for
ShowStringCharacters:
NotebookWrite[nb,
Cell[BoxData[ToBoxes@Grid[m1]], "Text",
ShowStringCharacters -> False]]
Note that I have wrapped the box expression with BoxData, which was
necessary in my version to avoid an error indication for the created cell...
hth,
albert
Actually, Grid@m1 *does* create something with quotes. They're just hidden by
virtue of the fact that the "Output" style has ShowStringCharacters->False set.
To see this, evaluate Grid@m1, then click in the cell and type a character.
This auto-converts the cell into an Input cell, and the quotes will pop back
into existence.
If this kind of solution is satisfactory to you, then the only thing you have to
change is...
NotebookWrite[nb, Cell[ToBoxes@Grid[m1],"Text", ShowStringCharacters->False]]
However, if there are quotes you did want to see, and they don't show up inside
of a string (e.g. "a quote -> \" <-"), then this will cause problems.
Sincerely,
John Fultz
jfu...@wolfram.com
User Interface Group
Wolfram Research, Inc.
m1 = {{"a", b}, {c, d}};
nb = CreateDocument[];
NotebookWrite[nb,
Cell[ToBoxes@Grid[m1], "Text", ShowStringCharacters -> False]]
Alternatively, you can specify "Output" style rather than "Text" style
for your cell.
Unformatting existing cells and copy/pasting the expression revealed, is
a great way to create new cell expressions in your code.
David Bailey
http://www.dbaileyconsultancy.co.uk
a function like the following:
In[21]:= f[x_String] := ToExpression[x];
f[x_] := x;
Map[f, {{"a", b}, {c, d}}]
can do the job for you.
Alexei
Can someone show me how to write the list m1 to a notebook without the quotes showing?
m1 = {{"a",b},{c,d}};
nb = CreateDocument[];
NotebookWrite[nb, Cell[ToBoxes@Grid[m1],"Text"]]
The expression below gives the right result so there is something missing in my limited understanding of Cell expressions.
Grid@m1
Thanks
Robert
--
Alexei Boulbitch, Dr., habil.
Senior Scientist
IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg
Phone: +352 2454 2566
Fax: +352 2454 3566
Website: www.iee.lu
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.