From: steven.zacharski on
Hello

I am working with an excel file with data on multiple sheets where I
may not know the sheet name

I'm trying to automate my calculations by reading the xls file and
saving the sheet names into a matrix (see example below)


[txt0,descr] = xlsfinfo('C:\inputs.xls')
m=size(descr,2)
for(i=0:1:m)
txt = xlsread('C:\inputs.xls', descr(1,i)))

I want to "automate" the xlsread function by referring to the stored
string information in the 'descr' variable..... but xlsread won't let
me read non-string values?


Is this possible, for what I want to do?


Best Regards
Steven
UBC
From: steven.zacharski on
I found a solution after a few trial and errors.... hope this helps
others in the future!!!!

Name = 'C:\filename';
[txt0,descr] = xlsfinfo(Name);
m=size(descr,2);
for(i=1:1:m)
Sheet = char(descr(1,i)) ; % Need to convert double array to
character array so the xlsread function can use the name
txt = xlsread(Name, Sheet);

Best of luck,
Steven
UBC


On Oct 16, 4:22 pm, "steven.zachar...(a)gmail.com"
<steven.zachar...(a)gmail.com> wrote:
> Hello
>
> I am working with an excel file with data on multiple sheets where I
> may not know the sheet name
>
> I'm trying to automate my calculations by reading the xls file and
> saving the sheet names into a matrix (see example below)
>
> [txt0,descr] = xlsfinfo('C:\inputs.xls')
> m=size(descr,2)
> for(i=0:1:m)
> txt = xlsread('C:\inputs.xls', descr(1,i)))
>
> I want to "automate" the xlsread function by referring to the stored
> string information in the 'descr' variable..... but xlsread won't let
> me read non-string values?
>
> Is this possible, for what I want to do?
>
> Best Regards
> Steven
> UBC