How to read Excel file with changing the range automatically

1 view (last 30 days)
HI All,
I am having problem to change the excel range automatically, and need to do it manually everytime
example
columnD = xlsread(filename,'D1:D1000');
The D1:D1000, I need to change it manually. Is there a way to change it automatically. Well I have tried few things below, but does not work
D(x):D(y) - does not work
D%d:D%d - does not work
D{x}:D{y} - does not work
Please help to show me how to control this.
Thank you Manimara

Answers (1)

Yao Li
Yao Li on 14 May 2013
i=1;
j=1000;
range_array=strcat('D',num2str(i),':D',num2str(j));
  2 Comments
Yao Li
Yao Li on 14 May 2013
yes, it's much better. Thanks, Jan. But maybe D is missing
range_array = sprintf('D%d:D%d', i, j)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!