|
Hi,
I have a REAL TIME PLOT running on GUI matlab and I want to implement a slider control to adjust the sample time ( the speed of the graph) on the spot. Here is my code.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global BBB;
min = 5;
max = 255;
sliderstep = [5, 10];
%
set(handles.slider1,'Value',10, 'Min', 6, 'Max', 255);
% set(handles.slider1, 'SliderStep', sliderstep);
samptime = get(handles.slider1, 'Value');
fprintf('Slider new value = [%1f]\n', Value);
if(samptime <= max && samptime >= min)
BBB.PushMTRN3100Msg(1,[01, samptime], 13, 20); % a command that changes the sample time of the real time graph
else
BBB.PushMTRN3100Msg(1,[00, 00], 13, 20); % a stopping command
end;
return;
I want to get the graph change the speed of reading messages by moving the slider button. Any help will be appreciated?
p.s don't worry about the commands. They are implemented through external sources that have been confirmed to work.
|