Controlling the input cursor position for gtext

조회 수: 7 (최근 30일)
Charles Medler
Charles Medler 2021년 4월 28일
I think I understand this problem, just looking for a work-around:
I use a user-response via the intput function to accept a candidate model shown in a plot. If the model is accepted, the user is to hit enter. Works fine.
Then later in the calling script, after plotting several model functions (within a for loop) I use gtext to annotate the plot.
Before have a chance to place the cursor for the gtext response I get the fatal error message;
****************************
Error using matlab.graphics.primitive.Text/set
Error setting property 'Position' of class 'Text':
Value must be a 2 or 3 element vector of numeric or logical type.
Error in gtext (line 55)
set(ht, 'String', string(rows,:), 'Units', 'data', 'Position', [x y 0]);
Error in WatersSegsmModel_psd (line 284)
gtext(gtxt,'FontSize',12);
********************
If I then enter the gtext statement at the prompt, it works perfectly well.
SO - apparently the user-entered return during the model selection is being interpretted by gtext as a misplaced cursor position.
HOW DO I AVOID THIS CONFUSION?
Thanks.
Chuck Medler

답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by