MATLAB: Help: XLSREAD with an unpsecified number of colums

unspecified columunspecified rowxlsread

Hi
Instead of using xlsread(filename, -1) to choose interactively any region of data, how could I use the following function with a variable of colum?
inputdata=xlsread('c:\thm.xlsx','sheet1','a1:letter(x)')
Where, "letter" and "x" are colum variables. "letter" variable may be B, C, D, E, F or whatever. And "x" may be 1, 2, 3, 4 or whatever. They are not specified and depend on users. Are there any ways to execute the above function?
Khanh.

Best Answer

If you also want columns:
range = sprintf('%c%d', column+64, row);
This will only work up to column Z, after that you'll have to write a function to do the conversion, it's going to be something like:
if column <= 27 %one letter
colletters = char(column + 64)
elseif column <= 27*28 %two letters
column = column - 28;
colletters = sprintf('%c%c', floor(column/27)+65, mod(column, 27)+65);
elseif ... %for three letters