How can I obtain char matrix from excel?

8 次查看(过去 30 天)
Hi everybody,
I have a excel file (216x1) and I convert to it a char matrix (216x1). How can I do it?
I presented my excel file in attachment.

采纳的回答

Voss
Voss 2023-11-20
filename = 'S5_origin.xlsx';
In R2015a, you can try using readtable to generate a table. Note the resulting table has 215 rows, since the first row of the file was interpreted as the variable name.
T = readtable(filename)
T = 215×1 table
GAS1C1 __________ {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'}
I'm not sure what readtable options were available in R2015a to try to change how the file was interpreted, so if readtable doesn't work or the result is not to your liking, you can use xlsread to generate a cell array of char vectors:
[~,~,c] = xlsread(filename) % c is a cell array of char vectors (216x1)
c = 216×1 cell array
{'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C1'} {'GAS1C2'} {'GAS1C2'} {'GAS1C2'}
I don't think you really want a 216x1 char matrix.
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by