Check a mathematical string for syntax errors in Matlab

117 Views Asked by At

As an example I have this string: "12+8*(23+4)*cos(0.813)" which would be correct. In this: "12+8*)23+4)*co(0.813)" I should get an error for the first brace ")" and "co".

Is there a way to filter such problems by checking with regular expression or regular language analyser like Coco/R for c#? There you can declare a grammar, tokens etc. and check if a string matches your language.

Only Matlab itself should be used.

0

There are 0 best solutions below