Store values from text file into uitable

2 次查看(过去 30 天)
I created a uitable in GUI and I am trying to get data from a text file to upload into the first column. This is as far as I got.
fid = fopen('file.txt','r'); %open txt file
rawdata = fscanf(fid,'%g',[1 inf]); %store
rawdata=rawdata';
set(handles.uitable1, 'rawdata', Data(:,1)); %store in column 1 of uitable1
Could someone pin point where I'm going wrong?

采纳的回答

Geoff Hayes
Geoff Hayes 2015-3-22
Laurie - you need to set the Data property of the uitable1 with the data. There is no rawdata property that you can access (and so are probably observing some kind of error). Try the following instead
set(handles.uitable1, 'Data', rawdata);
The syntax for set is to supply the handle, then the property name, and then the data that you wish to update the property with. If rawdata is a single column then presumably only the first column (in the table) will be updated.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by