Insert Table Into Figure - MATLAB Answers - MATLAB Central

3
0 votes Asked by noga cohen on 7 Feb 2011 Accepted Answer by Patrick Kalita 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 0 Comments insert table into figure figure table Tags No products are associated with this question. Products 1 Answer

description

matlab

Transcript of Insert Table Into Figure - MATLAB Answers - MATLAB Central

Page 1: Insert Table Into Figure - MATLAB Answers - MATLAB Central

9/2/2015 insert table into figure - MATLAB Answers - MATLAB Central

http://in.mathworks.com/matlabcentral/answers/974-insert-table-into-figure 1/3

0 votes

Asked by noga cohen on 7 Feb 2011

Accepted Answer by Patrick Kalita

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

0 Comments

insert table into figure

figure table

Tags

No products are associated with this question.

Products

1 Answer

Page 2: Insert Table Into Figure - MATLAB Answers - MATLAB Central

9/2/2015 insert table into figure - MATLAB Answers - MATLAB Central

http://in.mathworks.com/matlabcentral/answers/974-insert-table-into-figure 2/3

0 votes

Link

Answer by Patrick Kalita on 7 Feb 2011

Accepted answer

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

]);

1 Comment

Jonathan Lee on 17 May 2013

Link

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',[]);

Page 3: Insert Table Into Figure - MATLAB Answers - MATLAB Central

9/2/2015 insert table into figure - MATLAB Answers - MATLAB Central

http://in.mathworks.com/matlabcentral/answers/974-insert-table-into-figure 3/3

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today