Controlling the input cursor position for gtext

7 views (last 30 days)
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

Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!