Matlab function Will not work
1 view (last 30 days)
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
%Then grab the string value and pass it to the function input
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?
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?
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 on 4 Feb 2013
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.