Add Text Subscript to Table string

8 views (last 30 days)
Luck Haviland
Luck Haviland on 28 Sep 2022
Edited: Luck Haviland on 28 Sep 2022
Say I have a composite.
The composite has a layup [0 90 0 90 0_8]
I am trying to output this layup into a table using the table() function. This is my current output:
Example="[0 90 0 90 0 90 0_8]"
Example = "[0 90 0 90 0 90 0_8]"
T=table(Example,'RowName',"Layup Orientation")
T = table
Example ______________________ Layup Orientation "[0 90 0 90 0 90 0_8]"
I want the 8 to be a subscript on the 0. How do I do this?
Thank you very much,

Answers (1)

Steven Lord
Steven Lord on 28 Sep 2022
You don't. The text in the table doesn't have any sort of formatter or interpreter associated with it; it's a collection of characters.
If you were to specify that as the appropriate property of a Handle Graphics object, an object with something like an Interpreter property, you could tell it to interpret the string differently when that object displays it. For instance, a plot's Title is a text object with an Interpreter property.
title("[0 90 0 90 0 90 0_8]", 'Interpreter', 'Tex')
  1 Comment
Luck Haviland
Luck Haviland on 28 Sep 2022
Edited: Luck Haviland on 28 Sep 2022
Hi Steven, this is very good to know. It appears to me that table does not have an "Interpreter" option. If it does not have this option I would like to formally request this option to be implemented into the table() function.
I have looked across the internet a little bit and I have found several functions that use the 'Interpreter' handle. However, the ones I have found all seem to be used for plots, not tables.
I have tried wonky methods such as:
Example=text(0,0,"[0 90 0 90 0 90 0_8]",'Interpreter','Tex')
Example =
Text ([0 90 0 90 0 90 0_8]) with properties: String: '[0 90 0 90 0 90 0_8]' FontSize: 10 FontWeight: 'normal' FontName: 'Helvetica' Color: [0 0 0] HorizontalAlignment: 'left' Position: [0 0 0] Units: 'data' Show all properties
table(Example,'RowNames',"Layup Orientation")
ans = table
Example __________________________________ Layup Orientation 1×1
I also tried the set() function, but it is says it is not compatible with the table() function. I also messed around with the varfun() function, but it did not appear to work either. However, I have never used the varfun() function before, so maybe it would work if played with enough.
TL;DR: My methods did not work. I need more help please.
Thank you,

Sign in to comment.


Find more on Characters and Strings 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!

Translated by