Unrecognized method, property, or field 'Position' for class 'matlab.gr​aphics.Gra​phicsPlace​holder'.

조회 수: 149 (최근 30일)
Hi,
When I run my Matlab script I get the following error:
Unrecognized method, property, or field 'Position' for class 'matlab.graphics.GraphicsPlaceholder'"
Error in TCAS/TCASUIFigureSizeChanged (line 714)
px = pax.Position;
The part of script with this error is:
pax = findobj(app.GraphPanel, 'Type', 'PolarAxes');
px = pax.Position;
pi = pax.TightInset;
px(1) = pi(1);
px(2) = pi(2);
px(3) = 1 - pi(1) - pi(3);
px(4) = 1 - pi(2) - pi(4);
pax.InnerPosition = px;
I don't really understand what the problem is.
Also, the script runs fine if it is run in Matlab. Once the script is compiled, the program run fine until it goes into an external function, execute it but the script is not able to return into the main script and finish ti execute it. Are the two problems linked?
Matlab version is 2019b
Thansk,

답변 (1개)

Walter Roberson
Walter Roberson 2020년 7월 8일
Your findobj() is not locating any PolarAxes, and is returning the empty GraphicsPlaceholder object.
When you ask to access a field of an empty object, then MATLAB first checks to see if the field exists and complains if it does not. It does not first check to see if the object is empty.
The syntax for accessing object methods is the same as the syntax for asking for fields, and it is not generally an error to ask to apply a method to an empty object (provided that the method is appropriate for the object), so emptiness checking is not done first.
You should be checking isempty(pax) or isvalid(pax) or ishghandle(pax)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by