Store values from text file into uitable

2 views (last 30 days)
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?

Accepted Answer

Geoff Hayes
Geoff Hayes on 22 Mar 2015
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.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!