What is C here?
Changing variables in different functions
1 次查看(过去 30 天)
显示 更早的评论
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});
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!