What is this error about after am trying to indice an image out of a uibutton and uicontrols ?
1 次查看(过去 30 天)
显示 更早的评论
I use this script
bg = uibuttongroup('Visible','off',...
'Position',[0 0 .2 1],...
'SelectionChangeFcn',@Do_plot, ...
'Tag', 'BG1');
handles.BG1 = bg;
guidata(bg, handles);
r1 = uicontrol(bg,'Style',...
'radiobutton',...
'String','Option 1',...
'Position',[10 350 100 30],...
'HandleVisibility','off');
r2 = uicontrol(bg,'Style','radiobutton',...
'String','Option 2',...
'Position',[10 250 100 30],...
'HandleVisibility','off');
% Make the uibuttongroup visible after creating child objects.
bg.Visible = 'on';
And this function in the end
function Do_plot(hObject, event, varargin)
bg = findobj(gcf, 'Tag', 'BG1');
sel = bg.SelectedObject;
if isempty(sel)
return; %no buttons selected
end
sel_string = sel.String;
switch sel_string
case 'Option 1'
bg.Value = croppedImage;
case 'Option 2'
bg.Value = J;
end
bg= double(bg);
end
And I get that error
Error using uint8
Conversion to uint8 from matlab.ui.container.ButtonGroup is not possible.
Error in ruller (line 181)
figure,imagesc(uint8(Img),[0 255]),colormap(gray),axis off;axis equal
>>
Why is that?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!