How can I write function in label in Matlab app designer?

Hello,
I'm creating an app designer and I want to write this following function in label:
Here I have numerical values for parameters K, TL, TI, WN, zeta and tau. My app designer already calculated these.
But I cannot write this function exactly in this form into label. I cannot show the division or exponent. How can I write this? Thank you!

6 commentaires

I'd suggest to not waste time trying -- create an image of the generic equation that (I think?) you can use as label display and then make a display box/table of the specific parameter values.
Unless the computed values are integers, it'll be really, really messy to include the constants inside the equation, even if it were trivial to format as desired.
$0.02, im(ns)ho, ymmv, etc., etc., etc, ...
I understand, but we have a app designer that calculates integers of parameters of this function.
Actually we added divison symbol as image but if there was a method with coding, we want to do with this way.
So do you suggest add division symbol (------) as image? But how can we add exponent?
I generally "don't do windows" so am not at all expert in GUIs and what can, cannot be done realistically. If I get a pushbotton with a text label that says "Go!", I'm generally happy. :)
So, I don't know what you can manage to do with LaTeX in label strings; in theory you can typeset equations as complex as you wish. Whether the rendering engine in MATLAB is sufficient to the task, I've no klew; never tried. I know there are certainly limitations in easily using a lot of external packages and so on; seems like I did see an Answer thread not terribly long ago that had some more exotic features in it, but I didn't save any links to it and am not absolutely positive it was here or on StackOverflow site, maybe.
There's another report-writer tool that I've also never tried; I don't know if that might be another alternative route or not, either.
Thank you. Actually I’m not an expert too. This is my first app. I thought there must be a way to do this but i dont know how i can do this. It can be solved by add images but i dont want to do with that way :) Maybe there will be someone to answer my problem.
Here's the one I recalled -- as of R2020b, the label and text ui figures didn't have an Interpreter property for LaTex; that seems to have been added in R2021a, but with glitches...
I also see my thinking you could paste in an image is also in error; it accepts only text, so that's also not a way to manage the desired effect.
I come back to the question of is it really worth the time being spent--or could that time more profitably be spent using the app to solve whatever problem it is designed for even if not quite so fancy?
Sorry for answering after so long. Yes you're right. Adding an image can cause an error because the line image is showing if only the user has this image.
I reconsider and re-read your answers but i guess i dont understand what you suggest for my problem. Sorry, i am at the beginning of designing app designer. Thus, i cannot understand everything i read clearly.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 8 Juin 2021
uilabel() https://www.mathworks.com/help/matlab/ref/uilabel.html supports LaTeX and dynamic strings.
Computing a latex string can be a nuisance, keeping the \ straight (since \ introduces escape sequences in sprintf() and compose() ) but it is at least possible.

5 commentaires

Another place where not going with FORMAT model instead adds grief...
the FORMAT model cannot handle embedding newlines in any easy way; you have to use tricks like appending CHAR(10) to trim() of a string. http://computer-programming-forum.com/49-fortran/9317c41f4f4f4325.htm
dpb
dpb le 8 Juin 2021
Modifié(e) : dpb le 8 Juin 2021
A minor inconvenience relative to such abominations are forced into such as 'repmat('%f,3,1)', etc., etc., etc., ...
And, while it is an extension, many compiler support C-style escape sequences directly either via the backslash \n form or via a "'C" appended to a hex or octal constant. Having vectorized the C library, making similar extensions wouldn't have been that much of a problem for TMW for the FORMAT facility.
And, even without those, it's no big deal to define a string variable as needed; my always-included utility module had the set of those normally wanted.
17F5.2 is certainly more convenient than repmat('%5.2f', 1, 17)
I do find though, that if I have long formats, that I often want to compute the format. For example I might have code that needs to check size() of a matrix to find out how many fields to construct in the format.
dpb
dpb le 9 Juin 2021
Modifié(e) : dpb le 9 Juin 2021
Well, it's still simpler to write '%dF5.2' in the code that writes out the format string than filling in the repmat() template or (ugh!) just dumping out 238 consecutive 'F5.2' strings in a row.
At one time I had a pretty extensive mex file that took FORMAT expressions and handed off to the Fortran i/o library, but TMW broke support for the former compiler I used and once I gave up the consulting gig, it just wasn't sufficient need to fight the hassles of getting a compiler supported and working again.
I had provided TMW with that code with the hope they might consider an extension, but nothing ever happened. It's still a sore substitute without repeat fields and nested and group repeat specifications.
NAMELIST is another trick I played with some along the same lines.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Signal Integrity Kits for Industry Standards dans Centre d'aide et File Exchange

Produits

Version

R2020b

Question posée :

le 8 Juin 2021

Commenté :

le 14 Juil 2021

Community Treasure Hunt

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

Start Hunting!

Translated by