- All variables have to be of the same type/size so can be catenated into an array, and
- Lose the table variable headings.
Displaying MATLAB tables wrapped
조회 수: 24 (최근 30일)
이전 댓글 표시
I only starting using the MATLAB datatype, table, a few years ago but have always been annoyed that when I display a table in MATLAB, if you have many fields, the display runs off the right side of the command window display and you have to scroll right to see other columns (other fields). I recently had to step back to MATLAB 2014 in a specific setting and starting using tables in that envronment as well. The function, head did not exist back then but I could do something similar with:
disp(TBL(1:6,:));
And wouldn't you know it,the display actually wrapped at the end of the command window such that I did not have to scroll to the right to see what I needed ... I only needed to scroll up and down. With no success, I have searched and searched the settings for a switch to make table display wrap. Does anyone know if there is a setting that wraps table display? Thanks, Dan
댓글 수: 3
Catalytic
2023년 7월 3일
Why is scrolling up and down better than scrolling left to right? Generally, computer monitors are wider than they are tall, so you will have to do more up-down scrolling for wrapped output than unwrapped.
답변 (1개)
Matt J
2023년 6월 30일
편집: Matt J
2023년 6월 30일
One possibility,
TBL=array2table(rand(4,12));
wrapit(TBL)
function wrapit(T,ncols)
if nargin<2, ncols=7; end
M=ceil(width(T)/ncols);
for i=1:M
k=min(ncols,width(T));
t=T(:,1:k); T(:,1:k)=[];
disp(t)
end
end
댓글 수: 2
dpb
2023년 7월 5일
It (disp) will adhere to the global Preferences setting for "Wrap Variables", but it wraps every line of the table rather than keeping rows together so they intermix...
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!