Controlling the input cursor position for gtext
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!