MATLAB: How to save the value of checkboxes to plot only the selected in another function in Guide

checkboxesguidevalue

I have some checkboxes and I want to plot only data that is selected. My problem is to get the information if the checkboxes are selected or not. Using Guide.

Best Answer

You can use
checkboxValue = get(handles.checkBox1, 'Value');
No need to cast to double, and don't use hObject. This will work in ANY callback function, not just the callback of the checkbox itself, but also the callback of any other control (buttons, etc.) as long as you don't use hObject. If you need to get the checkbox value in other functions (non-callback functions), such as those you wrote, the easiest thing to do is to just pass handles into those functions. Otherwise you can check out the FAQ for harder ways: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Related Question