Filter löschen
Filter löschen

GUIDE - Slider control table for new data

1 Ansicht (letzte 30 Tage)
Ricardo Gutierrez
Ricardo Gutierrez am 30 Jan. 2017
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?

Antworten (1)

Jan
Jan am 30 Jan. 2017
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

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by