Having a problem with MATLAB reconising variables
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
Image Analyst
2014년 1월 15일
You forgot to post your error message. Please post ALL the red text, exactly as it appears. Don't snip or paraphrase.
답변 (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
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!