How to fill a UItable with parsed string data

조회 수: 1 (최근 30일)
Eth
Eth 2018년 12월 29일
댓글: Eth 2018년 12월 30일
I'm reading the contents of a text file that are formatted as follows:
fid = fopen(o.names{1},'r');
data = textscan(fid, '%s', 'Delimiter', '\t', 'CollectOutput', true);
I'm using the '\t' as a delimiter to load this data. I would like to display this data on a UITable control in appdesigner which should contain 5 columns (Name,Address,Region,upper,lower) and 4 rows. I've tried the following:
file_1={length(data{1})};
for I=1:length(data{1})
file_1{I} = char(data{1}{I});
end
fclose(fid);
app.UITable.Data = file_1;
But when displaying this data on the UITable it is all in 1 row with multiple columns and not 4 rows by 5 columns like I would like.
  댓글 수: 1
Eth
Eth 2018년 12월 30일
I was able to solve my issue by using readtable(). Makes things alot easier.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by