Upload data to uitable

조회 수: 1 (최근 30일)
laurie
laurie 2015년 4월 3일
편집: laurie 2015년 4월 4일
%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!

채택된 답변

Jan
Jan 2015년 4월 3일
편집: Jan 2015년 4월 3일
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
laurie
laurie 2015년 4월 3일
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 2015년 4월 4일
편집: laurie 2015년 4월 4일
The error I made:
[~,~,raw]=xlsread(filename,'A:B');
Thank you Jan Simon.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by