Borrar filtros
Borrar filtros

Creating a custom copy of a Matlab function (xlsread)

1 visualización (últimos 30 días)
Denys
Denys el 11 de Mayo de 2011
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?

Respuesta aceptada

Andy
Andy el 11 de Mayo de 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.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by