How to insert data into a GUIDE GUI for a creation function.

조회 수: 11 (최근 30일)
Bryce Karlins
Bryce Karlins 2018년 8월 1일
답변: Kevin Chng 2018년 8월 2일
I'm trying to add data into my GUI, and use some of that data to populate a listbox.I have a function, FileRead that ingests a certain file, and returns a table with 10 fields. I've called that function and added it to the handle structure as below:
% add the tables into the handles structure
handles.OrigTable = FileRead('ntap_data.ntap');
handles.filteredTable = handles.OrigTable;
guidata(hObject,handles)
and then I tried to use that data in the CreateFcn for the listbox here:
function squawks_CreateFcn(hObject, eventdata, handles)
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
squawks = categories(handles.OrigTable.Squawk);
set(handles.squawks,'String',squawks);
but it looks like the CreateFcn is running before ReadFile can finish ingesting the data and dropping it in handles.
How can I get it to pull this data?

답변 (1개)

Kevin Chng
Kevin Chng 2018년 8월 2일
Hi,
You may try this :
set(handles.OrigTable,'data',info)
I found there are two answers explaining well related to your questions:
We may discuss further if you still encounter any problems.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by