I am developing a MATLAB GUI using app designer andI am trying to make an app which includes Button Group and Spinner. What I want to do is that when specific button is chosen it changes step size but when I change to another button it would still hold previous value and add new values to that. My function looks like this.
properties (Access = public)
X = 0;
Y = 0;
Z = 0;
end
% Value changed function: Spinner
function SpinnerValueChanged(app, event)
if app.mVButton.Value == 1
app.Spinner.Step = 0.001;
app.X = app.Spinner.Value;
app.Spinner.Value = app.X + app.Y + app.Z;
elseif app.mVButton_2.Value == 1
app.Spinner.Step = 0.01;
app.Y = app.Spinner.Value;
app.Spinner.Value = app.X + app.Y + app.Z;
else
app.Spinner.Step = 0.1;
app.Z = app.Spinner.Value;
app.Spinner.Value = app.X + app.Y + app.Z;
end
end
end
Many thanks in advance.
Best Answer