Extracting character from an excel file

조회 수: 7 (최근 30일)
pradeep kumar
pradeep kumar 2014년 9월 28일
댓글: pradeep kumar 2014년 9월 28일
Hello everyone . Suppose i have an excel file (data.xlsx) , which contains the following data.
Name age
Tom 43
Dick 24
Harry 32
Now i want to extract the data from it and make 2 cell array (or matrix) which will contain
name = ['Tom' ; 'Dick';'Harry']
and age = [43;24;32] .
Please help me . how efficiently i obtain this . Thanks in advance

채택된 답변

Guillaume
Guillaume 2014년 9월 28일
The simplest way, would probably be to use readtable and get your data as a table:
t = readtable('data.xlsx');
  댓글 수: 2
Image Analyst
Image Analyst 2014년 9월 28일
Then, if for some reason you want to break them out separately, do...
name = t.Name;
age = t.age;
I agree this is the best way. You can use tables if you have R2013b or later. If not, (UPGRADE!) then you can use xlsread().
pradeep kumar
pradeep kumar 2014년 9월 28일
i have used xlsread(data.xlsx) , but its only extracting the numerical values ,but i want to obtain both as mentioned above . Please help me out

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by