How to add lines between specific rows and col's in a table?

조회 수: 11 (최근 30일)
Amanda
Amanda 2021년 4월 25일
댓글: Amanda 2021년 4월 25일
Let's say I have this matrix:
M 1 2 3 4 5 6 7
_ _ __ __ __ __ __ _
M 0 0 0 0 0 0 0
M 0 0 0 0 0 0 0
M 0 0 0 0 0 0 0
M 0 0 0 0 0 0 0
How can I draw a horizontal line between this first and second row?
And a vertical line between columns 6 and 7?
is this possible?
if this involves downloading a package, where can I do so?
Thank you,

채택된 답변

Adam Danz
Adam Danz 2021년 4월 25일
편집: Adam Danz 2021년 4월 25일
No, it is not possible to display horizontal and vertical lines in a table or in a uitable.
You could add a column of characters "|" to simulate a dashed vertical line but since your table contains numeric values you cannot use the same approach to add a horizontal line but you could add a horizontal row of NaN values for a visual separator.
  댓글 수: 2
Adam Danz
Adam Danz 2021년 4월 25일
@Amanda another idea to visually group columns of a table is to use nested tables.
T1 = array2table(rand(10,3),'VariableNames',{'a1','a2','a3'});
T2 = array2table(rand(10,3),'VariableNames',{'b1','b2','b3'});
T = table(T1, T2,'VariableNames',{'Group1','Group2'})
T = 10×2 table
Group1 Group2 a1 a2 a3 b1 b2 b3 ________________________________ ________________________________ 0.16812 0.28017 0.95857 0.093635 0.28161 0.79661 0.033868 0.52494 0.7073 0.3808 0.49159 0.57436 0.12971 0.011963 0.076642 0.79273 0.39691 0.96186 0.38691 0.96205 0.60905 0.79519 0.97328 0.27091 0.5583 0.72393 0.25809 0.32267 0.84849 0.94615 0.71782 0.26672 0.2257 0.44711 0.88207 0.53404 0.85151 0.86651 0.88928 0.090695 0.50398 0.066152 0.26138 0.80449 0.68335 0.0047975 0.11711 0.68808 0.050793 0.49833 0.28434 0.67507 0.8772 0.73168 0.24256 0.84214 0.73277 0.15012 0.57785 0.15575
Amanda
Amanda 2021년 4월 25일
Thank you! I hope they can do something for horizontal lines one day too.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by