Thread Subject:
Need help with slider control.

Subject: Need help with slider control.

From: Izuru Gajaweera

Date: 15 Aug, 2012 12:55:11

Message: 1 of 1

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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
slider control Izuru 15 Aug, 2012 08:59:10
rssFeed for this Thread

Contact us