필터 지우기
필터 지우기

GUIDE - Slider control table for new data

조회 수: 1 (최근 30일)
Ricardo Gutierrez
Ricardo Gutierrez 2017년 1월 30일
댓글: Ricardo Gutierrez 2017년 1월 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