Remove Redundant Parentheses from String Expression
Mostrar comentarios más antiguos
String contains a long expression. Part of it is:
'...+(G0*(G1-G2+G3))+((G4*(G5+G6)))-(((G7+G8))*((G9+G10+G11)))+...'
The redundant parentheses could be removed and the expression should look like:
'...+G0*(G1-G2+G3)+G4*(G5+G6)-(G7+G8)*(G9+G10+G11)+...'
Is there a simple Matlab script to do this?
5 comentarios
dpb
el 7 de Jun. de 2016
" redundant parentheses must be removed"
Why is this a must?
Where did they come from; perhaps the place to look is in the tool that generated them instead of trying to fixup the result.
I suppose there's a parser somewhere, but it would have to be smart enough to determine which are and which aren't actually redundant which isn't totally trivial exercise in general.
per isakson
el 8 de Jun. de 2016
S H
el 8 de Jun. de 2016
Walter Roberson
el 8 de Jun. de 2016
https://github.com/ewiger/decade/tree/master/lib/mparser
S H
el 10 de Jun. de 2016
Respuestas (1)
Image Analyst
el 8 de Jun. de 2016
0 votos
Recall that Azzi answered this, or something pretty much similar, and you accepted his answer in http://www.mathworks.com/matlabcentral/answers/287777#answer_224489
4 comentarios
S H
el 8 de Jun. de 2016
S H
el 8 de Jun. de 2016
Star Strider
el 10 de Jun. de 2016
@S H —
Don’t get cheeky.
Revise the documentation for the Symbolic Math Toolbox simplify function.
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!