Note that there are some explanatory texts on larger screens.

plurals
  1. POrefreshing guide with radiobutton and slider
    primarykey
    data
    text
    <p>I have a question that include radiobuttons and slider. My aim is this: when the value of the slider is changed, the code in the radiobutton selected in the moment must be rerun to refresh the effect.</p> <p>te max, min and step of the slider is defined in the opening function and the current value is defined to <code>handles.value</code>.</p> <p>here's my slider code.</p> <pre><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) handles.svalue = get(handles.slider1, 'Value'); guidata(hObject, handles) </code></pre> <p>here's my radiobutton group selection change code.</p> <pre><code>function uipanel3_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to the selected object in uipanel3 % eventdata structure with the following fields (see UIBUTTONGROUP) % EventName: string 'SelectionChanged' (read only) % OldValue: handle of the previously selected object or empty if none was selected % NewValue: handle of the currently selected object % handles structure with handles and user data (see GUIDATA) switch get(eventdata.NewValue,'Tag') % Get Tag of selected object. case 'hte' h_te = zeros(handles.rows, handles.colums); for m = handles.row_0:handles.rows gauss = fspecial('gaussian',[1 round(1+handles.svalue*(m-handles.row_0+1))], (0.3*round(1+handles.svalue*(m-handles.row_0+1)))); h_te(m,:,1) = filter2(gauss, handles.img_d(m,:,1)); h_te(m,:,2) = filter2(gauss, handles.img_d(m,:,2)); h_te(m,:,3) = filter2(gauss, handles.img_d(m,:,3)); h_te(handles.rows-m+1,:,1) = filter2(gauss, handles.img_d(handles.rows-m+1,:,1)); h_te(handles.rows-m+1,:,2) = filter2(gauss, handles.img_d(handles.rows-m+1,:,2)); h_te(handles.rows-m+1,:,3) = filter2(gauss, handles.img_d(handles.rows-m+1,:,3)); end axes(handles.axes2); imshow(h_te); case 'hc' h_c = zeros(handles.rows, handles.colums); for m = handles.row_0:handles.rows gauss = fspecial('gaussian',[1 round(1+handles.svalue*(m-handles.row_0+1))], (0.3*round(1+handles.svalue*(m-handles.row_0+1)))); h_c(m-handles.row_0+1,:,1) = filter2(gauss, handles.img_d(m-handles.row_0+1,:,1)); h_c(m-handles.row_0+1,:,2) = filter2(gauss, handles.img_d(m-handles.row_0+1,:,2)); h_c(m-handles.row_0+1,:,3) = filter2(gauss, handles.img_d(m-handles.row_0+1,:,3)); h_c(handles.rows-m+handles.row_0,:,1) = filter2(gauss, handles.img_d(handles.rows-m+handles.row_0,:,1)); h_c(handles.rows-m+handles.row_0,:,2) = filter2(gauss, handles.img_d(handles.rows-m+handles.row_0,:,2)); h_c(handles.rows-m+handles.row_0,:,3) = filter2(gauss, handles.img_d(handles.rows-m+handles.row_0,:,3)); end axes(handles.axes2); imshow(h_c); case 'vlr' v_lr = zeros(handles.rows, handles.colums); for m = handles.colum_0:handles.colums gauss = fspecial('gaussian',[round(1+handles.svalue*(m-handles.colum_0+1)) 1], (0.3*round(1+handles.svalue*(m-handles.colum_0+1)))); v_lr(:,m,1) = filter2(gauss, handles.img_d(:,m,1)); v_lr(:,m,2) = filter2(gauss, handles.img_d(:,m,2)); v_lr(:,m,3) = filter2(gauss, handles.img_d(:,m,3)); v_lr(:,handles.colums-m+1,1) = filter2(gauss, handles.img_d(:,handles.colums-m+1,1)); v_lr(:,handles.colums-m+1,2) = filter2(gauss, handles.img_d(:,handles.colums-m+1,2)); v_lr(:,handles.colums-m+1,3) = filter2(gauss, handles.img_d(:,handles.colums-m+1,3)); end axes(handles.axes2); imshow(v_lr); case 'vc' v_c = zeros(handles.rows, handles.colums); for m = handles.colum_0:handles.colums gauss = fspecial('gaussian',[round(1+handles.svalue*(m-handles.colum_0+1)) 1], (0.3*round(1+handles.svalue*(m-handles.colum_0+1)))); v_c(:,m-handles.colum_0+1,1) = filter2(gauss, handles.img_d(:,m-handles.colum_0+1,1)); v_c(:,m-handles.colum_0+1,2) = filter2(gauss, handles.img_d(:,m-handles.colum_0+1,2)); v_c(:,m-handles.colum_0+1,3) = filter2(gauss, handles.img_d(:,m-handles.colum_0+1,3)); v_c(:,handles.colums-m+handles.colum_0,1) = filter2(gauss, handles.img_d(:,handles.colums-m+handles.colum_0,1)); v_c(:,handles.colums-m+handles.colum_0,2) = filter2(gauss, handles.img_d(:,handles.colums-m+handles.colum_0,2)); v_c(:,handles.colums-m+handles.colum_0,3) = filter2(gauss, handles.img_d(:,handles.colums-m+handles.colum_0,3)); end axes(handles.axes2); imshow(v_c); end guidata(hObject, handles) </code></pre> <p>I thought calling the uipanel3 function inside the slider one would work but it does not. here's what I thought would work.</p> <pre><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) handles.svalue = get(handles.slider1, 'Value'); uipanel3_SelectionChangeFcn(hObject, eventdata, handles); guidata(hObject, handles) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload