How to show a whole table in Matlab variable window

14 views (last 30 days)
Hi,
When I make a large table and try to view it in the variable view window in the Matlab UI, instead of seeing all the values and variable names I just see a summary of the size of the table. Is there any way to view the whole table in some other way, or to extend the number of columns shown?
Thanks for any help,
R.
% Here you can see the whole table:
x = rand(10,10);
y = array2table(x);
% Here you will get a summary:
x = rand(10,10000);
y = array2table(x);
  2 Comments
A. Sawas
A. Sawas on 9 Apr 2019
Variables editor:
"The contents of a table are only visible and modifiable when the number of variables is fewer than 5000. When the number of variables equals or exceeds 5000, you can only view the table properties."
It seems this is a rigid limitation in the Variables Editor in Matlab. Why not to save the table as csv format and view it using Excel ?
Neuropragmatist
Neuropragmatist on 10 Apr 2019
Hmmm, that's interesting, I couldn't find the documentation on this so thanks for that.
The odd thing is that in the table I want to view I don't have more than 5000 variables. However, some of the variables are cell arrays containing 100x100 (RxC) matrices. So maybe Matlab is counting them as 100 variables wide or something?
This is also the reason I don't want to save as a csv file, because I haven't found a way to write a table containing cell arrays to csv.

Sign in to comment.

Answers (1)

Neuropragmatist
Neuropragmatist on 10 Apr 2019
I found why this was happening in my case - if you assign an empty value to a table column the variable editor switches from showing the contents of the table to showing the properties only.
Normally Matlab will not let you assign an empty [] value to a table but if you assign it to all columns of a table row (i.e. table1.variable1(1,:) ) it works but removes the table editor view.
I'm not sure if this is a bug or a feature?
The effect can be demonstrated here:
% this table can be viewed in the variable editor perfectly fine and the contents of v1 and v2 can be viewed and edited
t = table;
t.v1(1) = {rand(10,10)};
t.v2(1,:) = {rand(10,10)};
% this table cannot be viewed, only the properties can be viewed, despite the table actually being smaller
t = table;
t.v1(1) = {rand(10,10)};
e_array = [];
t.v2(1,:) = e_array;
  4 Comments
Peter Perkins
Peter Perkins on 12 Apr 2019
Metioche, I'm not sure I've made myself clear.
In my previous post, take a close look at t2 and t. t2 is not an "edge case" of t, it is a completely different kind of table. I understood your question to mean, "I have a cell array in my table that contains other arrays. Why does the Variable Editor behave differently for this edge case?"
But it's not an edge case. But perhaps I have misunderstood your question.
Neuropragmatist
Neuropragmatist on 12 Apr 2019
I'm not sure I understand what you mean by an 'edge case'.
I was merely pointing out that you can't view a table in the variable editor if one of the variables has been set to empty in the way shown above.
The fact that matlab will show the table when the column contains an empty cell array instead suggests to me that the former case may be a bug, but I'm not certain that's actually the case.
It could be a bug that matlab lets you do this at all:
t2.v2(1,:) = e_array
It only works in this case because the table t2 has a single row. As soon as the v2 column has contents on other rows matlab will not let you assign an empty value to that column because the sizes don't match.
So maybe this 'bug' is actually irrelevant, because how often would someone be working with a single row table, accidentally assign an empty value to a column and then want to view it in the variable editor?
As you pointed out, using a cell array {e_array} solves the issue in all cases.
Hope this helps,
R.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!