|
"Eli Chmouni" <echmouni@gmail.com> wrote in message <h3g4u1$pd0$1@fred.mathworks.com>...
> Hello everyone
> i have created a gui that will run a software called flight gear ( flightgear is a free flight simulator that could be found online at flightgear.org) but what i am stuck on is the coding of the mfile related to that gui. I have several edit boxes that the user can input names for aircraft and airport and altitude and then the student should be able to click load causing a bat file in the background containing the same variables to be editted and updated.
> Does someone know how to take the inputs of the user from the edit text boxes and edit the bat files
> any code is appreciated
Suppose your edit boxes have handles edit1, edit2 and edit3, and your push button is push1. The contents of the edit text boxes are stored in the 'String' property. So, for example, your push button callback would look something like this:
function push1_Callback(src,eventdata)
% get contents of edit text boxes and write them to a file
% get contents
entry1=get(edit1,'String');
entry2=get(edit2,'String');
entry3=get(edit3,'String');
% write to file
% I'm not exactly sure what you want your output to look like, so
% here is some incomplete code to point you in the write direction
fid=fopen(filename.bat)
fprintf(fid,formatstring,etc.)
...
% now call flightgear with the bat file as input
flightgear(fid)
% I made up this command. I don't know anything about flightgear.
% Presumably if you can run it from within MATLAB, you can pass the .bat
% file as an input somehow. But I can't comment specifically on that.
end
By the way, correct me if I'm wrong in my assumption that a .bat file is just a text file saved with the .bat extension. If that's not the case, this may not be the right approach.
Hope this helps.
|