Unrecognized method, property, or field 'Position' for class 'matlab.graphics.GraphicsPlaceholder'.
145 ビュー (過去 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,
0 件のコメント
回答 (1 件)
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)
0 件のコメント
参考
カテゴリ
Help Center および File 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!