MATLAB Answers

Andreas
0

Access to Excel-Worksheet-Cells Property

Andreas
さんによって質問されました 2013 年 7 月 5 日
I want to access some excel data with a loop over some rows and columns. With vba, I am used to do this with the cell-property (!). That's my attemp in matlab:
excelObject = actxserver('Excel.Application');
excelObject.Visible = 1;
oWorkbook = excelObject.Workbooks.Open('C:\abc.xls');
oWorksheet = oWorkbook.Sheets.Item(1);
oWorksheet.Activate;
% Here I want to get the address of cell B2:
disp oWorksheet.Cells(2,2).Address;
% The error Index exceeds matrix dimensions occures
It looks like matlab wants to use the Cell-Property as an array - not as a property with two arguments.
How can I access the Cells-Property? I tried the "get"-Function, but this doesn't help me.
Regards
Andreas

  0 件のコメント

サインイン to comment.

2 件の回答

Friedrich
回答者: Friedrich
2013 年 7 月 5 日
 採用された回答

Hi,
use this:
get(get(oWorksheet,'Cells',2,2),'Address')

  1 件のコメント

Andreas
2013 年 7 月 8 日
Thanks a lot.

サインイン to comment.


Tom
回答者: Tom
2013 年 7 月 5 日

oWorksheet.Range('B2')

  1 件のコメント

Andreas
2013 年 7 月 8 日
Thank you. I want to make a loop through my sheet. That's why I want to use the numeric mode.

サインイン to comment.



Translated by