Update variable value with slider in MATLAB

Asked

Viewed 147 times

1

I have a struct file: x.head=imread('Brain.jpg'); Whos x

I have a slider:

 G3.slide = uicontrol('style','slide',...
                 'unit','pix',...
                 'position',[400 280 120 30],...
                 'min',-10,'max',10,'val',1,...
                 'sliderstep',[1/20 1/10],...
                 'callback',{@sl_call3,G3});

calling the function:

function [] = sl_call(varargin)

% Callback for the slider.
[k,x] = varargin{[1,3]};
set(x.head,x.head*get(k,'value'))

But when I spin, I have the error:

Reference to non-existent field 'head'. Error in Project/sl_call (line 87) set(x.head,x.head*get(k,'value')) Error while evaluating Uicontrol Callback

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.