Controlling the input cursor position for gtext

10 Ansichten (letzte 30 Tage)
Charles Medler
Charles Medler am 28 Apr. 2021
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

Antworten (0)

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by