defined string as input for function
조회 수: 4 (최근 30일)
이전 댓글 표시
I have function which use load file that have some string inside it which I used it as input to my function so, I defined the load file and the input as the following:
load(file1) //file1 name is defined up so, I can change it any time
and I defined the input like
x11= low;
y11= vlow;
then in the function I defined the input as
x=x11;
y=y11;
but when I run it t give me undefined variables low & vlow. In addition, if I write x=low & y=vlow with out define it up it work .
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 4월 6일
load() does not execute MATLAB commands present in text files. If you want to execute MATLAB commands in a file then you should run() the file.
댓글 수: 4
Walter Roberson
2018년 4월 12일
Is the file being loaded a .mat file, is is a text file containing the lines
x11= low;
y11= vlow;
and before that in the text file there is an assignment to the variables 'low' and 'vlow' ??
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!