Store values from text file into uitable

1 回表示 (過去 30 日間)
laurie
laurie 2015 年 3 月 20 日
回答済み: Geoff Hayes 2015 年 3 月 22 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by