Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6997779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:19:35+00:00 2026-05-27T20:19:35+00:00

I am using M 8.0.4. I am use TableView in demo Manipulate[] to display

  • 0

I am using M 8.0.4.

I am use TableView in demo Manipulate[] to display final solution data, which is a matrix of numerical data.

TableView is very nice to use, since it comes with an automatic scroll bars to move down the rows and to the right over the columns, so that one can see the whole matrix, while keeping the overall display area fixed. (I have an image at the bottom)

The problem that I am not able to find a solution for, is that I need to format the matrix data, so that it looks nice. Otherwise, if the a data element is too large to fit in a cell, it will wrap around, making the TableView misaligned. I also need to adjust decimal point an such other formatting.

I can’t apply NumberForm nor AccountForm to the data, and then apply TableView on the result, because TableView does not like to see those wrappers, it needs the numbers.

But if apply the AccountingForm to the TableView, then the numbers that represent the row numbers and column numbers, which are added by TableView automatically, get formatted as well. And I do not want those formatted as well. A row number should remain an integer, not floating point. I just want the data itself formatted.

I could not figure how to format the data from inside Table view. When I use FullForm to see how the data is kept inside TableView, I could not figure how to format it without breaking TableView.

I’ll show the problem, then show what I tried.

(* make up some data, and make a TableView of it *)
data = {{-1234.8, 0.123}, {0.12345678, 0.1234}}
tbl = TableView[data, ItemSize -> {{3, {8}}}, DefaultBaseStyle -> 11, 
  Spacings -> {.2, .1}, FrameStyle -> Gray]

enter image description here

Notice the row numbers and columns number (marked) are positive integers.

Now, I wanted to format the data itself, (the exact formatting options used below is just an example)

AccountingForm[tbl, {6, 3}, NumberSigns -> {"-", "+"}, 
 NumberPadding -> {"", ""}, SignPadding -> True]

But now the Table rows and columns are also formatted:

enter image description here

The FullForm of TableView is:

In[156]:= FullForm[tbl]
TableView[List[List[-1234.8`,0.123`],List[0.12345678`,0.1234`]],
          Rule[ItemSize,List[List[3,List[8]]]],
          Rule[DefaultBaseStyle,11],Rule[Spacings,List[0.2`,0.1`]],
          Rule[FrameStyle,GrayLevel[0.5`]]]

So the data in TableView can be pulled out using

In[166]:= tbl[[1]]
Out[166]= {{-1234.8,0.123},{0.12345678,0.1234}}

But when I change tbl[[1]], using ReplacePart[], with an AccountingForm version of the data, TableView no longer works:

formattedData = 
 AccountingForm[data, {6, 3}, NumberSigns -> {"-", "+"}, 
  NumberPadding -> {"", "0"}, SignPadding -> True];

In[245]:= tbl=ReplacePart[tbl,1->formatted]
Out[245]= TableView[{{-1234.8,+0.123},{+0.123,+0.123}},
          ItemSize->{{3,{8}}},DefaultBaseStyle->11,Spacings->{0.2,0.1},
          FrameStyle->GrayLevel[0.5]]

So, I broke TableView. Since it does not display any more.

Question is: How to format numeric data that goes into TableView without affecting the row/column index values?

Fyi, this is how the TableView looks inside one Manipulate demo I have. Notice the automatics scroll-bars. (In this one, I am not using NumberForm and its friends to do the formatting. But what I did is not very efficient, I’d rather use NumberForm if I can, hence my question)

enter image description here

thanks

update 12/22/11 1:30 AM

Here is a complete code example for Mike to follow up on his answer below

data = {{-1234.8, 0.123}, {0.12345678, 0.1234}};

newData = 
  Map[AccountingForm[#, {6, 3}, NumberSigns -> {"-", "+"}, 
     NumberPadding -> {"", ""}, SignPadding -> True] &, data, {2}];

tbl = TableView[newData, ItemSize -> {{3, {8}}}, Spacings -> {.2, .1},
   FrameStyle -> Gray]

Now how exactly do I use the Cell command for the above? (This is in Manipulate, not a notebook session, Manipulate runs all in one cell. I can’t make separate cells and such in this code. But for trying it, I can in a new notebook, but the actual code that will use this solution, has to run in a Manipulate with no Cells.

Update 12/22/11 5 am

I am noticing some not good performance of TableView. Consider this code

Remove["Global`*"];
ClearSystemCache[]
m1 = MemoryInUse[$FrontEnd];
N[m1/10^6]
n = 256;
data = Table[RandomReal[], {n}, {n}];
TableView[data, ContentSize -> {300, 300}]
m2 = MemoryInUse[$FrontEnd] - m1;
N[m2/10^6]

The data itself, assuming double for the reals, is about half MB only. ByteCount says
2 MB due to other bookkeeping data struct.

In[114]:= ByteCount[data]/10^6//N
Out[114]= 2.10948

But Front end seems to use much more RAM (for the whole TableView I mean not just the data), sometimes I get 20 MB and sometimes much more (got 100 MB at one time). But if you try the above on your computer, you’ll notice M is having hard time with this. I think it might be the rendering of the table part that causes M to take so much time.

I do not think 256 by 256 is such a large matrix. Even with 128 by 128, it was having hard time to render it on the screen. Once it is up, then it is fast and no problem using it.

It looks like TableView is not yet optimized well. I think I will only use it to display small part of the solution Matrix as the performance is not good to use it in a demo to display the whole solution, it will make the demo look bad.

The problem is that my solution matrix can be large, and I wanted a away to display the data in limited amount of GUI space. TableView is all what I can find that comes with scrollbars build-in. Nothing else in the Manipulate controls has something like this to use, so I have to use TableView.

Update 12/22/11 4 PM

Thanks for the hint by Mike below, I am now looking at using Pane with Scollbars, and it is working better than TableView. (still little slow with large data, but not as bad as TableView)

Here is a code example of doing that:

n = 32;
data = Table[RandomReal[], {n}, {n}];
grid = Grid[data, Spacings -> {.4, .4}, Alignment -> Left, Frame -> All];
grid = Style[NumberForm[grid, {6, 5}], LineBreakWithin -> False];
pane = Pane[grid, ImageSize -> {200}, Scrollbars -> True]

enter image description here

Only problem I noticed so far is that when n gets large, Pane generates this outer frame saying very large output was generated. But I am sure there is a programmatic way (option somewhere) to turn that effect off, I just started looking at this and should be able to find a way around this once I have my coffee. (fingers crossed)

enter image description here

good news

The “Very large output was generated” ONLY showed up when in notebook interface. When I put the code in a Manipulate and and run it, it did not show this output frame. So, I am happy now and this issue is closed. I’ll use Pane from now on. (Thanks again to Mike)

btw, to remove the message in question, here is a useful link I found:

http://forums.wolfram.com/mathgroup/archive/2009/Apr/msg00935.html

but I did not need to do anything for what I am doing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:19:36+00:00Added an answer on May 27, 2026 at 8:19 pm

    I guess this is a different enough method to post as another answer, though it clearly borrows from Mike’s answer.

    f = ToString @ 
        AccountingForm[#, {6, 3}, NumberSigns -> {"-", "+"}, 
         NumberPadding -> {"", ""}, SignPadding -> True] &;
    
    data = {{-1234.8, 0.123}, {0.12345678, 0.1234}};
    
    TableView[Map[f, data, {2}], ItemSize -> {{3, {8}}}, 
      DefaultBaseStyle -> 11, Spacings -> {.2, .1}, FrameStyle -> Gray]
    

    Mathematica graphics



    Since using ToString was non-intuitive, I decided to explore it a bit more. It seems that TableView suppresses quotation marks in strings, but only bare strings. e.g.:

    string = "\"\"\"test\"";
    
    TableView[{{ string }}]
    

    Mathematica graphics

    TableView[{{ {string} }}]
    

    Mathematica graphics

    Other interesting behavior can be seen with 2D formatted strings:

    string = "\!\(\*SuperscriptBox[SqrtBox[\"5\"], \"2\"]\)";
    
    TableView[{{ string }}]
    

    Mathematica graphics

    TableView[{{ {string} }}]
    

    Mathematica graphics

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iPhone application which uses a TableView to display XML data. The
Normally we all do use using System.Linq; and using System.Data.Linq; for example on the
I am using custom UITableview concept to show data in cell of tableview. My
In my app I'm using ELCTextfieldCell . The idea is to use the data
I am trying to use scrollToRowAtIndexPath on a tableView. I'm using the method below.
I'm using Core Data for a tableview. My data is ordered by the distance
Hello I am developing an app which is using a tableview with two sections(instead
I'm making an app which has a tableview and a DetailViewController. I'm using Apple's
What are the best practices for using use cases to model system behavior that
I want to use using statement purely for scope management. Can I omit holding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.