Rank: 499846 based on 0 downloads (last 30 days) and 0 file submitted
photo

Elliot

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Elliot View all
Updated File Comments Rating
15 Mar 2013 GUI Layout Toolbox Layout management objects for MATLAB GUIs Author: Ben Tordoff

I realized after posting that my last question didn't make any sense, because it related to behavior that I thought was stock Matlab, but actually is not. I have another question, though. I'm trying to layout a plot and a uitable, and make it possible to print to a pdf that looks like the graphics on screen. However, while the on-screen display looks good, the table covers up part of the plot in the pdf. Is there any way to print to a vector pdf so it looks exactly like what I see on screen?

Thanks in advance for your help.

Here's the script I'm using:

X = randn(100,3);
summaryStats = [mean(X); std(X); min(X); median(X); max(X)];

fig = gcf();
set(fig, 'paperunits', 'inches', 'papersize', [11 8.5], 'paperposition', [0 0 11 8.5]);
set(fig, 'units', get(fig, 'paperunits'), 'position', get(fig, 'paperposition'));
set(fig, 'resize', 'off');

vBox = uiextras.VBox('Parent', fig);

p = uicontainer('Parent', vBox);
ax = axes('Parent', p);
plot(ax, X);

tab = uitable('Parent', vBox, 'Data', summaryStats);
ext = get(tab, 'Extent');
set(vBox, 'Sizes', [-1 ext(4)]);

print -painters -dpdf test.pdf

14 Mar 2013 Panel Like subplot, but easier, and WYSIWYG export to file. Also fixes dashed/dotted lines in export. Author: Ben Mitch

I'm having a little trouble setting up the layout I want, that includes a plot above and a data table below. The two main goals are:

1. Let the plot take up as much space as possible without cutting off any of the table
2. When the window is resized, resize the plot but leave the height of the table fixed.

Below is what I have so far, but I have to fudge the height of the table, and the resizing doesn't work because I don't know how to access the properties of my uipanel and uitable from inside a callback function.

Can anyone please provide some guidance?

-----------------

% Create some data and a table
X = randn(100,3);
tableData = [mean(X,1); std(X,[],1)];

% Set up the figure
clf
set(f, 'units', 'normalized');

% Create the uipanels
u1 = uipanel('units', 'normalized', 'position', [0 0 1 1], 'backgroundcolor', [1 1 1]);
u2 = uipanel();

% Create the uitable and get the relevant sizes
tab = uitable('Parent', u2, 'Data', tableData, 'units', 'normalized', 'position', [0 0 1 1]);
pos = get(u2, 'position');
ext = get(tab, 'extent');
set(u2, 'position', [pos(1:3) ext(4)]);

% Set up the panel
p = panel(u1);
p.margin = [5 5 5 5];

% Pack two subpanels, with the bottom panel's height fixed (to hold the
% uitable)
% Can I automatically account for the margins without having to add a
% buffer like this?
p.pack([-1 ext(4)+0.02]);

% Add the plot
p(1).select();
plot(X);

% Add u2
p(2).select(u2);

% Get rid of the scrollbars
jtab = findjobj(tab);
set(jtab, 'VerticalScrollBarPolicy', 21);
set(jtab, 'HorizontalScrollBarPolicy', 31);

% If I set up a call back, how do I access the position of u2 and the
% extent of tab from the 'data' argument?
%p(2).setCallback(@callbacktest);

08 Mar 2013 GUI Layout Toolbox Layout management objects for MATLAB GUIs Author: Ben Tordoff

I've just started using this toolbox, and it looks great. One question: it looks like the standard Matlab rollover functionality (i.e. showing the values on the plot under the mouse) is working for only the last plot added. Is there any way to get it to work for all plots in a figure?

Contact us