display image with uicontrol mouse

1 view (last 30 days)
alize beemiel
alize beemiel on 6 Oct 2020
hi
i want display image when i move the mouse on axes or on buton
i found how to change color but i dont know how display image
function enableMouseOverState(hUiControl)
% ensure non-empty handle
[x,map]=imread('image001.jpg');
I2=imagesc(x);
%purpl = [0.7922 0.5725 0.8510];
%indigo = [0.272 0.336 0.781];
%indigodark =[0.1882 0.2441 0.66];
%gray1 = [0.7725 0.7922 0.927];
%gray2 = [0.9198 0.916 0.967];
%gray3 = [0.9041 0.9021 0.9021];
%gray4 = [0.8115 0.8115 0.8115];
%gray5 = [0.9166 0.9177 0.9177];
%gray6 = [0.9704 0.9604 0.9804];
%gray7 = [0.4588 0.4688 0.457778];
%graydark = [0.3815 0.38055 0.380555];
%graydivers= [0.1296 0.1295 0.1297];
if isempty(hUiControl)
return;
end
% get the UI control type
uiControlType = getUIControlType(hUiControl);
if isempty(uiControlType)
return;
end
% set the UI Control property to a mouse over state
if strcmpi(uiControlType,'pushbutton')
set(hUiControl,'BackgroundColor',[0.7804 0.7804 0.7804]);
elseif strcmpi(uiControlType,'axes')
%imshow(x, 'parent',handle.axes1)
set(hUiControl,'cdata',x);
end
in the last line
i found how change color with
set(hUiControl,'color',gray);
but when i use cdata for display image i have error
There is no cdata property on the Axes class.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!