vendredi 24 juillet 2015

How create a mod (or text) file using a m-file in MATLAB (only print specific code lines in output file)

I want create a .mod (or text) file using a .m file in MATLAB R2015a. Suppose that we have this simple code in MATLAB (this is only an example):

clc;
clear;
close all;

a=4;

if a>3
    var x_1, x_2;
    shock 12, myshock>2,, xx;
else
    var x_5, x_6  
end

So based on this code we should have below function as output for mod (or text) file:

var x_5, x_6;
shock 12, myshock>2,, xx;

As you can see output functions aren't MATLAB functions. I want read output file by another software. I need build this specific file using MATLAB and it's functionality. As i mentioned this is only an example code. Final code has hundreds if/then and switches and it is connected to a GUI. So i need a straight procedure to only print specific line and functions to output file not only all lines of code. How can I do this?

Aucun commentaire:

Enregistrer un commentaire