I believe what you have written is the solution in this case.
To make you sure about MATLAB’s fismain, let me explain. If you compile fismain.c (including fis.h) you get a ready to use controller. You have to call fismain with two parameters: the name of the fis file and the name of a txt file with input data – one line is a single set of input data. The program sends lines of outputs to stdout. The advantage of this is that you can have your first controller running on your preferable hardware immediately. Programmers dealing with controllers don’t pay so much attention to graphics and nice “feel” of the software, but rather want to have the source code as short, easy and non-extravant as possible. Fismain fulfills this desire.