GUIDE - Slider control table for new data

2 次查看(过去 30 天)
I want to control a table from a slider, that is, when increasing the number of the slider the elements of the table must be saved and the table must be empty for the input of new data. Can anybody help me?

回答(1 个)

Jan
Jan 2017-1-30
You can insert the required code in the callback of the slider.
How did you create the GUI? By GUIDE or programatically? Do you know how to add a callback function to the slider? It would be easier to answer, if you post, what you have tried so far and ask a specific question.
A bold guess:
function MainGUI
handles.Fig = figure;
handles.Slider = uicontrol('style', 'slider', 'Position', [10, 10, 100, 15], ...
'Callback', @mySliderCB);
handles.Table = uitable('Position', [10, 40, 400, 200], 'Data', rand(4));
guidata(handles.Fig, handles);
end
function mySliderCB(SliderH, EventData)
handles = guidata(SliderH);
SliderUD = get(SliderH, 'UserData');
Value = get(SliderH, 'Value');
if ~isequal(SliderUD, Value) % Value has changed
Data = get(handles.Table, 'Data')
FileName = ??? % According to your needs
save(FileName, 'Data');
set(handles.Table, 'Data', cell(4));
end

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by