function update_function(hObject,eventdata,hfigure)
handles = guidata(hfigure);
B=zeros(7,7);
B(:)= single(42.0);
handles.current_data = B;
image(handles.temp_axes, handles.current_data, 'CDataMapping', 'scaled');
guidata(hfigure, handles);
Note that this will clear the axes each time, destroying the colormap information and the tick information and the colorbar. If you do not want that to happen, you should not image(). Instead:
hfigure = ancestor(handles.temp_axes, 'figure');
A = zeros(7,7);
A(:)= single(37.0);
handles.current_data = A;
handles.ImageH = image(handles.temp_axes, handles.current_data, 'CDataMapping', 'scaled')
axis(handles.temp_axes, 'image')
colorbar(handles.temp_axes);
colormap(handles.temp_axes, jet)
set(handles.temp_axes, 'YTickLabel',[]);
set(handles.temp_axes,'XTickLabel',[]);
guidata(hfigure, handles);
together with
function update_function(hObject,eventdata,hfigure)
handles = guidata(hfigure);
B = zeros(7,7);
B(:)= single(42.0);
handles.current_data = B;
set(handles.ImageH, 'CData', handles.current_data);
guidata(hfigure, handles);
Note that with scaled CData that is all constant value, you will not be able to see the difference between the two.
Best Answer