Simple Button
Show older comments
I'm trying to make simple button that will update image of a matrix with each press. Image should cycle through colors from blue to red. See code modified from GUI example below (how to update S.v?):
function [] = GUI_10()
S.fh = figure('units','pixels',...
'position',[200 200 500 500],...
'menubar','none',...
'numbertitle','off',...
'name','GUI_10',...
'resize','off');
S.ax = axes('units','pixels',...
'position',[75 150 350 350]);
S.v=ones(3,3);
S.im = image(S.v);
S.pb = uicontrol('style','push',...
'units','pixels',...
'position',[10 10 180 30],...
'fontsize',14,...
'string','Next',...
'callback',{@pb_call,S});
function [] = pb_call(varargin)
S = varargin{3};
S.v=S.v+1;
S.im=image(S.v);
Answers (1)
Walter Roberson
on 25 Jul 2011
0 votes
Categories
Find more on Image Processing Toolbox 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!