Info

This question is closed. Reopen it to edit or answer.

GUI Static text box incorrectly displays a '0'

1 view (last 30 days)
Tanya Rofani
Tanya Rofani on 6 Oct 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi
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';
else
position = 'SHORT';
end
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
Cheers

Answers (1)

Walter Roberson
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()

Community Treasure Hunt

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

Start Hunting!