フィルターのクリア

uicontrol text background color - value must be numeric

7 ビュー (過去 30 日間)
Allen Kelly
Allen Kelly 2014 年 12 月 5 日
コメント済み: Allen Kelly 2014 年 12 月 5 日
Hi guys, Am writing code to display a temporary figure displaying a generic 'file loading' msg while processing continues in background.
Am trying to change the background color of the text uicontrol that displays the msg so that it matches the background of the figure, but I get the following error msg
if true
% code
Error using uicontrol
Value must be numeric
end
here is a snippet of the code in question, the line beginning 'uicontrol' is the culprit, but I can't see whats wrong with the value for backgroundcolor.
if true
hFig = figure('Menubar','none', 'Resize','off', ...
'Units','pixels', 'Position',[300 300 225 imgH*1.3]);
movegui(hFig,'center')
hAx = axes('Parent',hFig, ...
'Units','pixels', 'Position',[(imgW*1.3-imgW)/2 (imgW*1.3-imgW)/2 imgW imgH]);
hImg = imshow(img(:,:,:,1), map, 'Parent',hAx);
uicontrol('Parent',hFig,'Style','text','BackgroundColor',[0.8 0.8 0.8],...
'Units','normalized','Position',[0.35 0.42 0.5 0.4],...
'String','Loading image(s): Please wait...','FontSize','12');
end
Any help is greatly appreciated, Thanks Allen

採用された回答

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2014 年 12 月 5 日
In your uicontrol when you use the Fontsize property remove the apostrophes around 12. It should be double not string.
  1 件のコメント
Allen Kelly
Allen Kelly 2014 年 12 月 5 日
Of course! The error was initially with the background color (had input 4 values instead of 3) so think I was fixed on that
Thanks for your help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by