insert table into figure

조회 수: 20 (최근 30일)
noga cohen
noga cohen 2011년 2월 7일
댓글: abdillah barkah 2016년 4월 26일
Hi All, I want to insert table and a plot to the same figure. The table is 2X3 (the first row is header - strings, and the second row is numbers). I can read the table from excel file or from 2 variables (header & values).
How can I do this?
Thanks :) Noga
  댓글 수: 1
abdillah barkah
abdillah barkah 2016년 4월 26일
can you help me to solve my problem, i cant make figure from gui table. thanks :)

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

채택된 답변

Patrick Kalita
Patrick Kalita 2011년 2월 7일
You'll want to use uitable. Here's a very simple example:
subplot(2,1,1);
plot(1:10);
uitable('Data', [1 2 3], 'ColumnName', {'A', 'B', 'C'}, 'Position', [20 20 500 150]);
  댓글 수: 2
Jonathan Lee
Jonathan Lee 2013년 5월 17일
편집: Jonathan Lee 2013년 5월 17일
Thanks for this post! It was really helpful! I ended up modifying the code above, and I wanted to share my own implementation:
f = figure(1);
set(f,'Position',[500 500 300 150]);
dat = {' a', 1, ' units';...
' b', 2, ' units';...
' c', 3, ' units';...
' d', 4, ' units';...
' e', 5, ' units';...
' f', 6, ' units';};
columnname = {'Parameter', 'Value', 'Units'};
columnformat = {'char', 'numeric', 'char'};
t = uitable('Units','normalized','Position',...
[0.05 0.05 0.755 0.87], 'Data', dat,...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'RowName',[]);
Bishal Santra
Bishal Santra 2016년 3월 27일
Thanks for sharing the code... Nice work :)

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by