insert table into figure

101 views (last 30 days)
noga cohen
noga cohen on 7 Feb 2011
Commented: abdillah barkah on 26 Apr 2016
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 Comment
abdillah barkah
abdillah barkah on 26 Apr 2016
can you help me to solve my problem, i cant make figure from gui table. thanks :)

Sign in to comment.

Accepted Answer

Patrick Kalita
Patrick Kalita on 7 Feb 2011
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 Comments
Jonathan Lee
Jonathan Lee on 17 May 2013
Edited: Jonathan Lee on 17 May 2013
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 on 27 Mar 2016
Thanks for sharing the code... Nice work :)

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!