How to extract a column numerical data as strings?

조회 수: 1 (최근 30일)
Leon
Leon 2020년 4월 7일
댓글: Leon 2020년 4월 7일
I have some data stored in xlsx format. There is always a column data called "Station IDs". Sometimes it is numerical and sometimes it is strings. I'm using readtable to read the xlsx file.
T=readtable('test.xlsx');
My program can automaticall identifically the column numer (n). I can get the whole column of data as:
A = T.(n);
Here is my question. How do I get the column values as strings no matter it is originally numerical or strings.
Thanks.

채택된 답변

madhan ravi
madhan ravi 2020년 4월 7일
A = string(T.(n)); % have to use string(...) :)
  댓글 수: 2
Leon
Leon 2020년 4월 7일
Many thanks!
It works flawlessly.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by