MathGroup Archive 2001

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

Search the Archive

Re: Queries: notebook, matrices

  • To: mathgroup at
  • Subject: [mg27019] Re: [mg26975] Queries: notebook, matrices
  • From: Tomas Garza <tgarza01 at>
  • Date: Tue, 30 Jan 2001 23:22:35 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

1. You can Select the input cells you would like to recalculate and then
Cell | Cell Properties | Initialization Cell. Then, when you reopen your
notebook and activate the first cell you will be asked whether you want to
initialize all cells. Say Yes and that's it. By the way if there is a lot of
time-consuming calculation which doesn't change from one session to the
next, you'd do well to save the results with >> and read them back with <<
instead of recalculating.

2. My guess is you'll have to specify each time that you want your matrix
displayed in matrix form. Of course you may define a function for that
purpose, which will save you the trouble of typing the whole thing, such as,

a = {{1, 2, 3, 4}, {4, 5, 6, 7}}
{{1, 2, 3, 4}, {4, 5, 6, 7}}
d[a_] := MatrixForm[a]
    RowBox[{"(", "\[NoBreak]", GridBox[{
          {"1", "2", "3", "4"},
          {"4", "5", "6", "7"}
          }], "\[NoBreak]", ")"}],
    (MatrixForm[ #]&)]\)

3. OK, there is a standard program which I got years ago from Wolfram
support, I guess, which takes data from Mathematica and stores them as
Ascii text files which can then be read by Excel or some other such
program (I presume you want to use your data outside Mathematica;
otherwise there is no point in saving it with a specified format). The
code is as follows:

WriteMatrix[filename_String, data_List] :=
 With[{myfile = OpenWrite[filename]},
  Scan[(WriteString[myfile, First[#]];
    Scan[WriteString[myfile, "\t", #] &, Rest[#]];
    WriteString[myfile, "\n"]) &, data];

Once you define this function WriteMatrix, you may use it as follows:

a = {{1, 2, 3}, {1, 4, 5}, {1, 6, 7}};

WriteMatrix["b", a]

This says: take list a and store it in Ascii form under the name "b".
Once you execute this, you will find b in the directory you're working.
Then you may read b from Excel.

Tomas Garza
Mexico City

----- Original Message -----
From: "M. Damerell" <uhah208 at>
To: mathgroup at
Subject: [mg27019] [mg26975] Queries: notebook, matrices

> Sorry if these are answered in a FAQ file, I could not
> find any FAq file for this group. Math. 4.0,  windows95.
> 1. I do a lot of calculation in a notebook, save it,
> then when I restart Math & open the file I have to
> recalculate each item before I can resume where I
> left off.  Is there any way to tell Math to recalculate
> everything when the file is reopened?
> 2. I enter a matrix as (say)  A={{1,2,3},{4,5,6} etc
> and it displays in that form. Is there any way to make
> Math display matrices as matrices? I know you can do
> B=A.A//MatrixForm
> this looks right but Math doesnt know this is a matrix.
> So I would like matrices to be held internally in list
> form but displayed in matrix form.
> 3. and finally, is there any way to export the matrix
> into  Excel?

  • Prev by Date: Re: 1. Input of screen coordinates; 2. Fast graphics
  • Next by Date: RE: RE: 1. Input of screen coordinates; 2. Fast graphics
  • Previous by thread: Queries: notebook, matrices
  • Next by thread: Re: Queries: notebook, matrices