How to display numerical data as subscript text in the UIAxes in App Designer when the data has multiple digits?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Raees Mohammed
il 6 Feb 2018
Risposto: Kai Domhardt
il 7 Feb 2018
Hi,
So I'm trying to create shapes in App Designer and insert labels within each shape. I'm using a for-loop to do this. Each index of the for-loop is referenced in creating part of the label for the shapes in the UIAxes. The sprintf function is used to convert the data into a string to display it at some coordinates. Here's an example:
text(app.UIAxes,50, 50, sprintf('%s_%d_%d', 'd^q',1,5), 'Fontsize',40)
axis([0 100 0 100])
The issue I've encountered is when this code is used, it provides the label where (d^q)_5. When I run this similar code in a Matlab script file, it works fine providing me with (d^q)_15.
Similar code:
text(50, 50, sprintf('%s_%d_%d', 'd^q',1,5), 'Fontsize',40)
axis([0 100 0 100])
It shows the number "15" as the subscript of "d" to the superscript of "q". I have no idea how to fix this. Please help me or tell me if it is even possible.
0 Commenti
Risposta accettata
Kai Domhardt
il 7 Feb 2018
You can use curley brackets to specify where the sup-/superscript starts and ends. See Text, under Interpreter.
text(app.UIAxes,0, 0.5, sprintf('%s_{%d_%d}}', 'd^{q',1,5), 'Fontsize',40)
would be 1 as subscript of q and 5 as subscript of 5.
If you just want 1 and 5 as subscript of d^q, this would do the trick:
text(app.UIAxes,0, 0.5, sprintf('%s_{%d%d}', 'd^{q}',1,5), 'Fontsize',40)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!