MATLAB: How to check syntax error in state flow chart

MATLABmodel advisorstate actionsstateflowsyntax check

Hello All,
I would like to check syntax errors in state flow state chart. As you see below, I have called state which is State_name, Inside this state I have different actions. If you see state_action2 = 0 missed by following semi colon(;) and state_action3 is not within state area.
How can I check state actions line by line and syntax errors by using m-script/commands?
Any help would be appreciated..

Best Answer

I give you a small code (not optimize and without check...). The code give the "txt" variable which is the text from a stateflow state and then I put each line in a cell of the cell array "Line".
nlChar = findstr(txt, 10);
Line{1,1} = txt(1:nlChar(1));
for i = 2:length(nlChar)
Line{i,1} = txt(nlChar(i-1)+1:nlChar(i));
end
Line{i+1,1} = txt(nlChar(i):end);
Then, when you have this cell aray, you just have to make your check on each cells.