matlab在excel文件中的cols数量

时间:2012-04-16 11:26:45

标签: excel matlab

是否有Matlab命令来获取excel文件中写入的cols数?

这是我的excel文件: enter image description here

这是我的代码:

e = actxserver ('Excel.Application'); %# open Activex server
filename = fullfile(pwd,'example2.xlsx'); %# full path required
ewb = e.Workbooks.Open(filename); %# open the file
esh = ewb.ActiveSheet;

我试过了:

intCol = Range('IV1').End(xlLeft).Col;

谢谢:]

1 个答案:

答案 0 :(得分:2)

怎么样:

[num, txt, raw] = xlsread('example2.xlsx');
intCol = size(raw, 2);