Matlab function Will not work
조회 수: 4 (최근 30일)
이전 댓글 표시
Hey guys, I have a function I'm creating and u want to assign values to the input but so far it's working. Function myname=myfunc( al,la,Li,ti) Now the values I want to pass to al, la, Li,ti are included in a .bat file I open the file
File=textread('input.bat','%s','delimiter','\n','whitespace','');
%Then grab the string value and pass it to the function input
al=file(2,:)
La=file(3,:)
and so on Then I open and .exe file and pass the input to it from that my batch file
Sysem('my file.exe< input.bat')
That line was the only line that I need to make my program works. But what I want to is to do is instead of having the value of al,la, Li, to to just print on the screen when I call the .exe file, I want to capture those values and plot them later if I want. So far I get the error that the input arguments appear to never be used. Can anybody help me because I tried everything?
댓글 수: 0
답변 (3개)
Jason Ross
2013년 2월 4일
In the code above, you have "File" and "file" as your variable names. Is this a typo, or does the case really vary in your code?
Jason Ross
2013년 2월 4일
If you set a breakpoint when the file is being read and step through, do the variables contain anything? As you step, you should be able to see the values change by hovering on the variable.
If you try using ".txt" as the file ending, does that change anything? On Windows, a .bat file has a specific meaning, so Windows could get confused later making a differentiation between the .bat and .txt file. Given the way you are using the file, it's not a batch file, it's just text.
It would also be good to look at the variable types that you get -- are they the types you expect them to be?
Image Analyst
2013년 2월 4일
You say "the values I want to pass to al, la, Li,ti are included in a .bat file" and then you want to, or try to, read this .bat file into MATLAB. Evidently from your m-file code, you think input.bat already has the value in it that are needed. But you don't really do anything with the file after your read it in. Why not? Why did you read it in in the first place???
Then you run your executable taking inputs from this input.bat file (which you never did anything with). Your line of thinking is a total mystery to me.
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!