Variables Window - Table / TimeTable Wrap, no horizontal scroll Option?

3 次查看(过去 30 天)
As you can see from a screen shot below, if you make a time table (or table) that has a high number of rows and columbs and open that table in the variales window it is very difficult to read due to Matlab wrapping the columbs.
I havn't been able to find anywhere in the settings where I can enable/disable this wapping feature from happening, where when disabled there the variables window would show a horizontal scroll when a table was opened with more columbs that could be displayed in the window.
Just imagine for a min if you had a table with 100+ columbs, and 1000+ rows, that would be near imposible to read using Matlab's built in variables window, you would need to save it off to view it in excel. This doesn't seem very friendly for debugging.
A second note, I found that the tables will only show a limited number of rows. In this example the variables window only goes up to the 54th row. Is there a way to view a table in the matlab variables window, and be able to scrow down through all the rows. The only way I can think to see what is in the table visually is by creating a new table with only 54 user selected rows (doesn't seem very clean).
If there is any existing features that would adress some of these issues which I am missing, please let me know.
  2 个评论
Rahul
Rahul 2024-10-3
Hi @Cody Brown, I'm unable to replicate this issue on R2023b, can you provide your timetable data and the Operating System you are using? That'll help in better understanding the issue.
Cody Brown
Cody Brown 2024-10-3
编辑:Cody Brown 2024-10-3
I am running matlab r2024a on Windows 10.
Okay so I found how to reproduce this. If all the datatypes of all the columbs are numbers (like NaN), then the table will apear as I would expect, and want it to be, where there is a horizontal scroll, you can vertically scroll to see all the rows, and there is an option for data statistics at the top. However, if you were to make a couple of the columbs of type string, then you can reproduce what I am seeing here. I'm wondering if there is an issue with having arrays, tables, structs, objects, exe inside a table that forces the way the table gets displayed in the variables window to this simplified version where columbs wrap, there is a limited number of rows visibal, and no option for data statistics at the top.
I have found that if you retun the table inside the Command Window that this wrap doesn't occur, there is a horizontal scroll, and there is a hyperlink to "Display all xxxxx rows." I would just like to have this exact functionality seen in the Command Window, in the varible's window, with perhaps also the data statistics at the top for compatable datatypes.
Here is some code that will reproduce this:
I can see that this online page here (as well as Matlab Online) is populating a horizontal scroll, however run this bit of code in matlab's window's application and you should see this behavior mentioned in this question thread.
%table's time columb:
startTime = datetime('now');
endTime = startTime + days(1);
dt = minutes(1);
time = transpose(startTime:dt:endTime);
TblLength = length(time);
%table's other columbs:
One = NaN(TblLength,1);
Tue = NaN(TblLength,1);
Three = NaN(TblLength,1);
Four = NaN(TblLength,1);
Five = NaN(TblLength,1);
Six = NaN(TblLength,1);
Seven = NaN(TblLength,1);
Eight = NaN(TblLength,1);
Nine = NaN(TblLength,1);
Ten = NaN(TblLength,1);
Eleven = NaN(TblLength,1);
Twelve = NaN(TblLength,1);
Thirteen = string.empty(TblLength,0);
Fourteen = string.empty(TblLength,0);
%create timetable:
T = timetable(time,One,Tue,Three,Four,Five,Six,Seven,Eight,Nine,Ten,...
Eleven,Twelve,Thirteen,Fourteen)
T = 1441x14 timetable
time One Tue Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen ____________________ ___ ___ _____ ____ ____ ___ _____ _____ ____ ___ ______ ______ __________ __________ 03-Oct-2024 13:25:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:26:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:27:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:28:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:29:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:30:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:31:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:32:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:33:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:34:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:35:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:36:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:37:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:38:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:39:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string 03-Oct-2024 13:40:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1x0 string 1x0 string

请先登录,再进行评论。

采纳的回答

Cris LaPierre
Cris LaPierre 2024-10-3
编辑:Cris LaPierre 2024-10-3
This only happens if you use empty strings. My recommendation would be to follow the same approach as you are using with your numeric variables. You aren't adding them as empty vectors. Instead, you are using the standard missing value for the datatype, NaN. I would suggest doing the same thing for your string data types. See missing
%table's time columb:
startTime = datetime('now');
endTime = startTime + days(1);
dt = minutes(1);
time = transpose(startTime:dt:endTime);
TblLength = length(time);
%table's other columbs:
One = NaN(TblLength,1);
Tue = NaN(TblLength,1);
Three = NaN(TblLength,1);
Four = NaN(TblLength,1);
Five = NaN(TblLength,1);
Six = NaN(TblLength,1);
Seven = NaN(TblLength,1);
Eight = NaN(TblLength,1);
Nine = NaN(TblLength,1);
Ten = NaN(TblLength,1);
Eleven = NaN(TblLength,1);
Twelve = NaN(TblLength,1);
Thirteen = strings(TblLength,1);
Thirteen(:) = missing;
Fourteen = strings(TblLength,1);
Fourteen(:) = missing;
%create timetable:
T = timetable(time,One,Tue,Three,Four,Five,Six,Seven,Eight,Nine,Ten,...
Eleven,Twelve,Thirteen,Fourteen)
T = 1441x14 timetable
time One Tue Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen ____________________ ___ ___ _____ ____ ____ ___ _____ _____ ____ ___ ______ ______ _________ _________ 03-Oct-2024 23:32:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:33:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:34:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:35:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:36:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:37:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:38:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:39:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:40:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:41:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:42:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:43:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:44:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:45:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:46:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing> 03-Oct-2024 23:47:46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> <missing>

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by