Changing variables in different functions

조회 수: 1 (최근 30일)
Luke Dineen-Woolnough
Luke Dineen-Woolnough 2016년 3월 4일
댓글: Walter Roberson 2016년 3월 5일
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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by