Data String unreadable in uitable matlab

3 ビュー (過去 30 日間)
joni nababan
joni nababan 2020 年 7 月 1 日
コメント済み: joni nababan 2020 年 7 月 2 日
Hello, Please someone help me
i have problem to display string data from ms.excel to uitable in matlab
this is my code :
[filename,path] = uigetfile('.xlsx')
dataExcel = xlsread(fullfile(path,filename),'sheet1','A2:F50');
name = dataExcel(:,2)
set(handles.uitable1,'data','ColumnName',{'Nama'});
This is the result :
Can you help me, please?
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 7 月 1 日
set(handles.uitable1,'data','ColumnName',{'Nama'});
That is invalid. After using the 'data' keyword, you need to pass in the data, such as
set(handles.uitable1, 'data', dataExcel, 'ColumnName', {'Nama'});
Please attach a copy of your xlsx file for testing purposes.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 1 日
Your use of 'Nama' as a header suggets that you expect the column you are selecting to be character vectors -- names. However when you use xlsread with only one output, then what is output is only numeric values and nan, with all character vectors replaced by nan. You would need to use the two or three output form of xlsread() to get at the character vectors.
I recommend that you switch to readtable() instead of xlsread()
  7 件のコメント
Walter Roberson
Walter Roberson 2020 年 7 月 2 日
data = readtable(fullfile(path,filename), 'sheet', 'sheet1', 'range', 'A2:F50');
stuff = table2cell(data(1:10,:));
handles.uitable1.Data = stuff;
joni nababan
joni nababan 2020 年 7 月 2 日
Thanks, Walter
Can i make plot from that data?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by