How can I write division formula in label of matlab app designer?
Show older comments
Hello everyone,
I have a problem about my matlab app designer label thing. I want to write a formula in the label but I have parameters that calculated before. I use fuzzy in the app, thus I have parameters like for example K_4 = output4(1);
and I have a formula that is Precision Model function that contains these parameters. Precision Model,

this is the sample of the app and you can see the FH(s) function. We created this with labels and used division image,

I want to write this function in the label form without using divison image. I found something like
app.Label.Text = '$$\frac{( numerator}{denominator}';
app.Label.Interpreter = 'latex';
But I cannot find how I can write my calculated parameters in this? If I wrote K_4 for example (like app.Label.Text = '$$\frac{( K_4}{denominator}';), it gets this as string.
Can you help me please?
3 Comments
dpb
on 26 Jul 2021
I think I recall there being "issues" with the LaTex interpreter and app designer in an earlier conversation similar to this, but I don't find it at the moment nor remember if there was a resolution.
But, that aside, set the interpreter property BEFORE writing the text.
hgrlk
on 26 Jul 2021
Well, you've got to write the string with compose or similar to substitute variables into the expression where they belong. It gets messy; write small pieces at a time and string them together to build to final result.
Another way to do such things is to build a template string that has embedded in it the space for a given size of number string and then do character substitution into those locations. That requires that the numbers will always fit into the given spaces, of course.
Start by getting a test expression to work with hardcoded numbers to work out the LaTex formula stuff; then you can work in the variables into that expression.
Good luck; my experiences w/ LaTex in MATLAB have been mostly frustrating ones...but I have no expertise in the area.
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
