Clear Filters
Clear Filters

Creating a custom copy of a Matlab function (xlsread)

1 view (last 30 days)
Hi,
I'm trying to create a copy of the xlsread function that will work slightly differently for my particular application.
What I tried is typing
edit xlsread
then going file/save as, and saving it in my working directory under a different name (and changing the function name to match its new file name).
When I try to use the new function, I get the following error:
??? XLSREAD unable to open test.xls. Undefined function or method 'validpath' for input arguments of type 'char'.
What is the problem?

Accepted Answer

Andy
Andy on 11 May 2011
If you type
which xlsread
you will see something like
C:\Program Files\MATLAB\R2009a\toolbox\matlab\iofun\xlsread.m
In the parent folder ...\iofun\, there is a subfolder ...\iofun\private, and this contains the function validpath. Mine is at:
C:\Program Files\MATLAB\R2009a\toolbox\matlab\iofun\private\validpath.m
If you also copy this file to the same location as your copy of xlsread, it should work. I highly recommend you change the name of the local copy of validpath (and change the call to it in your local copy of xlsread). It is clearly not a supported function, and may be used internally by other MATLAB functions. So if you altered your local file, you won't know what other consequences it might have.
Good luck.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!