Changing variables in different functions

1 Ansicht (letzte 30 Tage)
Luke Dineen-Woolnough
Luke Dineen-Woolnough am 4 Mär. 2016
Kommentiert: Walter Roberson am 5 Mär. 2016
Im trying to change a variable in one function using a separate slider function, I've managed to get the slider to change its current amount from 0 to 255, however it wont seem to assign this value to the variable i want to change. can anyone suggest what im doing wrong?
Code Below
Kind Regards
Luke
function f = slider(hObject,Reassign, ~, h)
set(h.buttonfour, 'Max', 255, 'Min', 0);
current = get(hObject, 'Value');
assignin('base', 'current', current);
set(Reassign(C ==3), 'Value', current);
%%Variable i want to change Reassign(C ==3), ive only used reassign atm as im unsure how to properly syntax Reassign(C ==3) as a variable.
Reassign = C;
Reassign(C == 1) = 10;
Reassign(C == 2) = 80;
Reassign(C == 3) = 210;
%%CallBack
set(h.buttonfour, 'callback', {@slider, Reassign(C == 3), h});

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by