Re: Simple Print question
- To: mathgroup at smc.vnet.net
- Subject: [mg59563] Re: Simple Print question
- From: carlos at colorado.edu
- Date: Fri, 12 Aug 2005 00:09:11 -0400 (EDT)
- References: <ddf5nj$oo8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Steve Gray wrote:
> I'm printing glist in a format that makes the entries' meaning clearer than just Print[glist], so I
> have a loop of Print[glist[[x]], over Length[glist]. This prints each line in a separate cell. I
> want all the lines to print in the same cell so the printing will be more compact vertically. I
> would appreciate any tips. Thank you.
>
> Steve Gray
One way is to build a Table, print it., then clear it.
Example from a finite element program:
PrintPlaneStressNodeCoordinates[nodxyz_,title_,digits_]:= Module[
{numnod=Length[nodxyz],n,x,y,z,d=6,f=6,tab},
tab=Table[0,{numnod}]; If [Length[digits]==2,{d,f}=digits];
For [n=1,n<=numnod,n++,{x,y}=nodxyz[[n]];
tab[[n]]={ToString[n],PaddedForm[x,{d,f}],PaddedForm[y,{d,f}]}];
If [StringLength[title]>0, Print[title]];
Print[TableForm[tab, TableAlignments->{Right},
TableDirections->{Column,Row},TableSpacing->{0,2},
TableHeadings ->{None,{"node", "x-coor", "y-coor"}}]];
ClearAll[tab];
];
PrintPlaneStressNodeCoordinates[{{1.5,2.5},{5.2,7.2}},
"Coordinates of tower model",{3,5}];