How can I convert the style of an equation in Matlab?

I have an equation represents the output of a data mining technique and the equation can not be understand by Matlab calculations as contains curly brackets, for example likes this:
'+150575023162.5103{Ey}^{}+3697.1458\frac{{Ex}^{}{Ey}^{}}{{}^{0.5}}+1.5498e-007'
I am using (strrep function) in Matlab to be used in further calculations, but this is not as practical way. Is there an efficient way for this? Many thanks

7 Kommentare

For your example, what would the desired output be?
ND
ND am 4 Jun. 2015
like 150554525162*Ey+3697\(Ex*Ey)+ 1.5... I mean normal equation to be readable in Matlab
That text has the appearance and structure of LaTeX, but it is not valid LaTeX. What is the intended meaning of {Ey}^{} and of {}^{0.5} ?
ND
ND am 4 Jun. 2015
Bearbeitet: ND am 4 Jun. 2015
{} = 1 Yes it is LaTeX interpreter how can I convert it to normal?
Why specifically raise a variable to the power 1, or explicitly take sqrt(1) ? Is Ey^1 a mathematical operation or is it signifying a variable named "Ey superscript 1" ?
ND
ND am 5 Jun. 2015
It is mathematical operation (power= 1), I do not know why it takes power 1? I cannot get jacobian matrix for the above equation and convert it using strrep or regexprep function is not feasible.
Why not just use the editor? A keyboard will convert that trivially.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 5 Jun. 2015

1 Stimme

LaTeX is a Turing Complete language. Parsing it to figure out what it means is the same as executing it. I don't think anyone has written a MATLAB implementation of LaTeX.
There are tools around for converting LaTeX to other formats, such as XML
If you were able to define a specific subset of LaTeX and functions or objects to be created for each subset, then it might be practical to use regexp 'tokens' to do the parsing. But it wouldn't be simple; see http://www.mathworks.com/matlabcentral/answers/121920-how-do-i-match-nested-parenthesis-brackets-or-braces-with-dynamic-regular-expressions for the difficulty in bracket matching.
My first preference in a matter such as this would be to go back to the program that output the LaTeX and alter it to output MATLAB instead. If that were not possible then I would switch to other tools such as using Yacc and Lex to do the parsing, possibly emitting MATLAB. If the subset of LaTeX used was very simple then I might do it all in MATLAB as a series of parsing routines.

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

ND
am 4 Jun. 2015

Kommentiert:

am 24 Jun. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by