Effacer les filtres
Effacer les filtres

GUIDE - Slider control table for new data

1 vue (au cours des 30 derniers jours)
Ricardo Gutierrez
Ricardo Gutierrez le 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?

Réponses (1)

Jan
Jan le 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
  1 commentaire
Ricardo Gutierrez
Ricardo Gutierrez le 30 Jan 2017
Jan Simon,
I use the Guide controls.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by