Function Input in command window
Show older comments
I am currently attempting to write a function that loops an input of another function. The main function is not mine, and is very long and complicated so I am trying to write a function to open this function and enter the inputs everytime with one input changed. The problem is that the function inputs are inputed in order in the command window so I can open the function in a script but I do not know how to enter the inputs. The function name is Tornado so I can write that in a script to open in.
Here is the code printed to the command window when that script is run:
Input operations.
[1]. Aircraft geometry setup
[2]. Flight condition setup
[3]. Change rudder setting
[4]. Move reference point
Lattice operations.
[5]. Generate lattice.
Computation operations.
[6]. Processor access
Post processing and interactive operations.
[7]. Post processing, Result/Plot functions
[8]. Keyboard access
Auxiliary operations.
[10]. About / Release Info
[100]. Help files
[0]. Exit Tornado
Please enter choice from above:
I attempted to just write in the new script:
Tornado
1
to try and enter the 1st option in the function. I then want to continue to enter inputs in this way. Any help would be appriciated, thank you.
11 Comments
dpb
on 29 May 2022
Would need to see the input section for the script to be able to tell for sure -- it looks like it may simply use input in a front end loop; there aren't simple ways to stuff the keyboard input buffer -- ways, but not trivial.
It may be simpler if you're using a particular functionality to find that functionality and create a routine to drive it directly, bypassing the main script.
As said, think only be able to really do anything if you show the code you're trying to drive and specifiy specifically what function(s) you're trying to use.
Jack McNulty
on 29 May 2022
Edited: Jack McNulty
on 29 May 2022
Voss
on 30 May 2022
If you are constrained to run the function without modification, then you might use java.awt.Robot (https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html) to generate the keyboard input automatically.
However, it's likely feasible to modify the function you've inherited, such that you can send input arguments rather than taking user-input on the command line via the input function. Then write your own script or function that runs the thing with the required sets of input parameters and collects the results.
I would lean toward the second approach, but I would have to see the code to know how involved the modifications would need to be. Can you upload the code so we can see how complicated it is?
Jack McNulty
on 30 May 2022
dpb
on 30 May 2022
That would fall more under the guise of consulting rather than simply helping with specific Q?,it would seem.
One could at least provide the link and as requested, the specific functionality being looked for.
Walter Roberson
on 30 May 2022
Edited: Walter Roberson
on 30 May 2022
http://tornado.redhammer.se/ is the link.
The reference manual is https://www.researchgate.net/publication/320924935_Tornado_10_USER%27s_GUIDE_Reference_manual
dpb
on 30 May 2022
The above Home page introductory text includes the following "...The code can either be run with a text based interface or in batch mode." but a cursory look through the documentation didn't include anything except using the text interface.
That would seem to imply it may have the facility OP is looking for, but it isn't made patently clear how to use it at least at the top level of any of the links or just what is available in batch mode.
Jack McNulty
on 30 May 2022
Stephen23
on 30 May 2022
@Jack McNulty: you should contact the authors of that code, who will be in a much better position to support you.
I've not looked at the code at all; I'd suggest given the above about batch mode you delve into the product to find out just what that implies/allows.
Surely there's a user community -- the author seems to still be actively supporting the product either as a side hustle or as his main occupation; there's the place to go for the real skinny.
Here, unless someone who is also a user just happens to see your Q?, there's nobody routinely here that has any experience with the product and it is a forum specifically on how to use MATLAB, not another application that happens to have been built using MATLAB. Also remember this is an all-volunteer forum.
Jack McNulty
on 30 May 2022
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!