Upload data to uitable

1 view (last 30 days)
laurie
laurie on 3 Apr 2015
Edited: laurie on 4 Apr 2015
%Upload Data in uitable3
handles.output=hObject;
[file,path]=uigetfile({'*.xls;*.xlsx','Excel Files'},'Select data file');
filename=strcat(path,file);
set(handles.upload);
data=xlsread(filename);
set(handles.uitable3,'Data',data
Column 1 consist of strings (words) and column 2 consist of integers.
But the strings don't upload; only the integers upload to the table.
How can I get the data strings to upload in column 1?
Thank you in advance!

Accepted Answer

Jan
Jan on 3 Apr 2015
Edited: Jan on 3 Apr 2015
xlsread replies the numeric values as first output. Therefore the variable data does not contain the strings in the first column and in consequence the uitable will not display strings. The 3rd output of xlsread might be better.
Please read doc xlsread.
Note: The line set(handles.upload); is meaningless.
  2 Comments
laurie
laurie on 3 Apr 2015
handles.output=hObject;
[file,path]=uigetfile({'*.xls;*.xlsx','Excel Files'},'Select data file');
filename=strcat(path,file);
[raw]=xlsread(filename,'A:B');
set(handles.uitable3,'Data',raw);
raw returns numeric text and data but when I implemented it, I get still get only numeric data
laurie
laurie on 4 Apr 2015
Edited: laurie on 4 Apr 2015
The error I made:
[~,~,raw]=xlsread(filename,'A:B');
Thank you Jan Simon.

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!