MathGroup Archive 1999

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

Search the Archive

Re: Automatic Display in MatrixForm


Hi mates!

I learned from David Withoff that it's much better to use $PrePrint
instead of $Post for this purpose, since the latter might influence
the values assigned to Out[i] and %i.

So this is what I put into my init.m:

--------------------------------------------------------------------
(* Matrices having at most "rows" rows and at most "columns" columns
   are displayed in MatrixForm *)
switchMatrixForm[rows_,columns_]:= (
  $PrePrint = If[MatrixQ[#] && Length[#]<=rows &&                 
                 Dimensions[#][[2]]<=columns,
                 MatrixForm[#],#]&
)

switchMatrixForm[18,7]
--------------------------------------------------------------------

You can switch it off or change the limits for the rows and columns
by using switchMatrixForm in your Mathematica session.

Yours sincerely
  Bruno


  • Prev by Date: Re: Re: Automatic Display in MatrixForm
  • Next by Date: Re: Short Doesn't Work
  • Previous by thread: Re: Re: Automatic Display in MatrixForm
  • Next by thread: Re: Automatic Display in MatrixForm