How to assign figure property with movegui() on Matlab subplot?

I need to assign the units inches for subplots (1-2). I added movegui() for the figure, after which I started to get the error. Without it, I donot get the error message. Code

hFig3=figure('Units', 'inches', 'Name', 'Time, Potential, T-p, T-p tiff');
movegui(hFig3,'northeast'); % without this, you do not get the error
% TechnicalMonitoring
b1=subplot(2,2,1); 
b2=subplot(2,2,2); 
b3=subplot(2,2,3); 
b4=subplot(2,2,4); 

% b1, b2 
hFig3.Children(1).Units = 'inches';
hFig3.Children(2).Units = 'inches';

Error

No public property Units exists for class matlab.graphics.GraphicsPlaceholder.

Error in code_1s (line 488)
    hFig3.Children(1).Units = 'inches';

Matlab: 2016a
OS: Debian 8.5 64 bit

Upvotes: 0

Views: 96

Answers (1)

Suever
Suever

Reputation: 65430

I cannot reproduce your error, but if you want to assign the units for specific subplots, then assign it explicitly for them rather than relying on hFig3.Children to return the subplots in a particular order. You can do this by passing an array of axes to set.

set([b1 b2], 'Units', 'inches')

Or if you really want to use dot notation you can do them individually

b1.Units = 'inches';
b2.Units = 'inches';

Or you can just set this when they are created

subplot(2, 2, 1, 'Units', 'Inches');

Upvotes: 1

Related Questions