function error- undefined variable

when i attempt to use a function an error occurs saying 'undefined function or variable' or it says there is an error in the script but there are none according to the side bar. its happening to every function i have - even the ones that were working previously.. HELP?!?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Jun. de 2011

0 votos

Please copy and paste the error here.
It could be that you accidentally added your own routine with the same name as one of the built-in routines.

5 comentarios

Corinne
Corinne el 11 de Jun. de 2011
do you have any idea how to fix this?
thanks
Walter Roberson
Walter Roberson el 11 de Jun. de 2011
You need to copy the exact error here so we can figure out which routine is involved. After that, you would use the "which" command on that function to determine where you accidentally wrote the file that is overriding the MATLAB version.
Corinne
Corinne el 12 de Jun. de 2011
it was saying undefined function or variable but now its:
??? Input argument "a" is undefined.
Error in ==> get_positives at 23
for element = a
but this function was working before...
i was reading the help document stuff and it said if the undefined error came up to change 'set path' to default. ive done that but still no luck.
Walter Roberson
Walter Roberson el 12 de Jun. de 2011
What statement in your code defines "a" ?
It is possible that you have a function instead of a script, and that you need to invoke the function from the command line, passing in the appropriate arguments. Look at the first non-comment line of get_positives.m and see if it starts with "function": if it does then at the command line you need to type something like
get_positives([-5,3,8,pi,-2,inf])
Corinne
Corinne el 13 de Jun. de 2011
all is good thanks for your help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by