MATLAB Answers

Tanya Rofani

GUI Static text box incorrectly displays a '0'

Asked by Tanya Rofani
on 6 Oct 2012


I've written a GUI to output plots in axes and a double in a static text box after analysis of a data series. The axes display the correct plots, the static text box displays the correct resulting double BUT it also displays an '0' before the correct result. I do not understand where the '0' is coming from and/or why it gets displayed right on top of the correct result. Any advice how to remove this? My code is below:

tsobj = x(end-90: end);
dayChange = diff(tsobj);
tsstd = std(dayChange);
pos_size = signal*1/tsstd;
if signal == 1
       position ='LONG';
    position = 'SHORT';
set(handles.text5, 'String', pos_size);

so as a result in text5 it displays the correct pos_size but also a '0' right on top




No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 6 Oct 2012

Is the the static text box a uicontrol()? And if so then did you position it within the bounds of the plotting (or perhaps just slightly outside)?

Static text boxes of type uicontrol are independent of any axes, and are rendered in the figure itself. Mixing plotting with uicontrol in the same area has undefined results. A uicontrol should be placed outside the OuterPosition of the axes if you need to use a uicontrol. If you want to place text inside an axes, you should use text()


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!