Error in buit in function
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mo BO
el 10 de Mayo de 2016
Comentada: Walter Roberson
el 10 de Mayo de 2016
i get error in built in function and i can't find out why and while trying to figure it out, i looked it up in the help and took the same example and then executed it in the command windows after trying the code i always get the same error ,but if cleared the work space and tried the example again before trying the code it works well it looks like the code make some thing wrong with the matlab *
3 comentarios
Walter Roberson
el 10 de Mayo de 2016
Yup, clearly they have created double.m and put it on their path.
Respuesta aceptada
Walter Roberson
el 10 de Mayo de 2016
When you created double.m in a local directory, and put the local directory on the path, that affected most calls to double(). MATLAB mostly finds appropriate routines by name: it usually starts at the beginning of the MATLAB path and looks for a double() in each directory until it finds one. It does not matter that the first routine you invoke does not call double(): that routine invokes another routine that does call double(), and the double.m that you put on the path now overrides the built-in double() routine.
You should not name your .m files the same as any Mathworks-provided routine unless you want your routine to be called instead of the Mathworks provided routine.
4 comentarios
Walter Roberson
el 10 de Mayo de 2016
Your function might be changing the MATLAB path.
To see if any particular name is in use for a function, use
which TheNameToCheck
for example
which image
which doublefactorial
The second of those turns out not to be used (but there is a MuPAD double factorial function named fact2)
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!