Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
xlsread

Subject: xlsread

From: Rogelio

Date: 25 Sep, 2010 11:54:05

Message: 1 of 3

Hi
I have written an m.file which calls xlsread function, e.g.

function f = myfunction (a,range,....., z)
getdata=xlsread('file.xlsx',{range});
.
.
.
end

I need to specify the actual range of the data when calling the function "myfunction", e.g

A=myfunction(a,{'A1:C50'},.....,z);

However, the way I have written doesnt work. I get the next error:
??? Error using ==> xlsread at 151
Range argument must be a string. See HELP XLSREAD.

How can I fix this??
Thanks!!

Subject: xlsread

From: ImageAnalyst

Date: 25 Sep, 2010 12:28:20

Message: 2 of 3

It wants a string, not a cell array. So get rid of the braces.

Subject: xlsread

From: Rogelio

Date: 25 Sep, 2010 12:51:22

Message: 3 of 3

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3b6414dd-f823-44ec-936d-a16183bebb82@j18g2000yqd.googlegroups.com>...
> It wants a string, not a cell array. So get rid of the braces.

You mean like this:

function f = myfunction (a,range,....., z)
getdata=xlsread('file.xlsx','range');
.
.
end
A=myfunction(a,'A1:C50',.....,z); ??

Then I get this error
??? Error using ==> xlsread at 277
Data range is invalid.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us