请教matlab如何获取Excel工作表的最后一行?。
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
以前我在 excel vba中用如下语句可以获取工作表的最后一行
ws.Cells(1,1).End(xlUp).row
但是该语句在matlab中会报错:函数或变量 'xlUp' 无法识别。
(说明:ws为工作表对象, ws.Cells(1,1)是获取第A1单元格,ws.Cells(1,1).End(xlUp)是获取第1列的有内容的最后一行,ws.Cells(1,1).End(xlUp).row是获取最后一行的行号。)
请问这个语句该怎么修改?或者有什么其他方法获取最后一行?
如果能告诉在哪里可以查到matlab操作Excel的函数说明,那就更好了
(Excel vba的函数语句不能直接用到matlab中)
谢谢!
0 Kommentare
Akzeptierte Antwort
hvvarpe
am 22 Mai 2023
调用CountA函数 数据连续的话
exl = actxserver('excel.application');
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open([docroot '/techdoc/matlab_external/examples/input_resp_data.xls']);%自带文件
exlSheet1 = exlFile.Sheets.Item('Sheet1');
Rows=exl. Application.WorksheetFunction.CountA(exlSheet1.Range('A:A'))
Rows =1590
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!