How can I determine last row and pointed out in a xlsread?

4 ビュー (過去 30 日間)
ugur uresin
ugur uresin 2018 年 7 月 8 日
コメント済み: ugur uresin 2018 年 7 月 8 日
My code is below:
[num, txt] = xlsread('S:/PLOT/PLOT.xlsx', 'D1:XFD1');
XFD1 is the last row in excel and it takes time!
Instead of writing XFD in this code, I'd like to write the name of the cell up to n lines from D1.
*
Example: Let n = 3.
D E F G
The code should scan from D1 to G1.

採用された回答

Paolo
Paolo 2018 年 7 月 8 日
編集済み: Paolo 2018 年 7 月 8 日
You may use this FEX submission for the task.
For n = 3:
starting_letter = 'D';
offset = xlscol(starting_letter);
n = 3+offset;
final_letter = xlscol(n);
range = strcat(starting_letter,num2str(1),':',final_letter,num2str(1));
Range:
'D1:G1'
For n= 16380
starting_letter = 'D';
offset = xlscol(starting_letter);
n = 16380+offset;
final_letter = xlscol(n);
range = strcat(starting_letter,num2str(1),':',final_letter,num2str(1));
Range:
'D1:XFD1'
In general, to find n, call the function with the name of the cell:
xlscol('XFD')
and subtract four to account for the offset.
  1 件のコメント
ugur uresin
ugur uresin 2018 年 7 月 8 日
Thank you so much for your effort!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by