I have created an uiTable in Matlab. Now I need to write column headers and some cell data, which contain greek letters and subscripts. In text objects or plots I would just enable the TeX interpreter - or it is even the default setting. This does not work in an uiTable. How would I do this here? Maybe pre-formatting the strings somehow?
If there would be a solution, the next question will be: I need this interpreter only in some cells (and column headers). Some other need to be printed as the strings are given. So basically, I would even need an individual TeX interpreter setting per cell. But I know this would be solvable by the correct string escaping...
Minimal example:
h = figure();
t=uitable(h);
set(t,'ColumnName',{'test_1';'\alpha'})
This looks like this. But it should be rather with an index "1" and an alpha character.
You can use html and unicode char to do what you want in the column headers.
You could use the str2html FEX submission to create the html and you need to know the unicode char for the greek letters:
h = figure();
t=uitable(h);
str = str2html ( 'test', 'subscript', '1' );
set(t,'ColumnName',{str; char(945)})
Note: the html in this example is: <HTML>test<sub>1</sub></HTML>
This produces:
You can use the same theory to display in the individual cells:
h = figure();
t=uitable(h);
str = str2html ( 'test', 'subscript', '1' );
Data{2,2} = str;
Data{3,3} = str2html ( 'test', 'superscript', '2' );
Data{4,1} = str2html ( '90', 'superscript', char(176) );
set(t,'ColumnName',{str; char(945); char(946)},'Data', Data)