Having a problem with MATLAB reconising variables
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I have two MATLAB files in my diretory, one is a list of variables, the other is an fsolve script which uses the variables from the previous script. I execute the the list of variables files so that the list of variables is in the workspace, but when I try and run my function file MATLAB says that the variables are undefined. Can anybody help?
1 comentario
Image Analyst
el 15 de En. de 2014
You forgot to post your error message. Please post ALL the red text, exactly as it appears. Don't snip or paraphrase.
Respuestas (1)
Your function has no idea of what's in your workspace. You need to pass these variables to the function if you want it to be able to see them. For that you could simply run the script inside your function:
function [bla] = your_fun(something)
myscript.m %Tada!!!
do your thing
end
For the sake of completeness, I should say that you could also declare them as globals. But that's always a terrible idea.
1 comentario
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!