Column width in uitable

23 次查看(过去 30 天)
john
john 2013-9-12
Hi,
if I press button, then new figure appears with uitable. Column width is always the same. How can I change column width? Or if I change column width manually by mouse and then I press button, then I wont to have width from mouse.
Thank you
Me code:
t = uitable('Parent',f,'Data',result,'Position',[10 10 630 400],'ColumnWidth','auto','RowName',rnames,'Columneditable',coleditable,'ColumnFormat',{'char', 'char', 'char', 'char', 'char', 'char'});

回答(1 个)

Jan
Jan 2013-9-12
I'm not sure if I understand your question.
You can change the columnwidth by not setting it to 'auto' but manually by a cell, which contains the width values. See http://www.mathworks.com/help/matlab/ref/uitableproperties.html#brgovhi.
You cannot obtain the changed width values as far as I know.
  11 个评论
john
john 2013-9-18
Hi, sorry.
I mean length of the string in cell when it is written to the screen.
I use to show something in table this code:
T = regexprep(cellstr(char(sym(UserData.matrix{4+i,1}))), '([A-Za-z]+)(\d+)', '$1<FONT SIZE=-1>$2</FONT>');
T = regexprep(T, '(Alpha|Beta|Gamma|thetasym|piv|Delta|Epsilon|Zeta|Eta|Theta|Iota|Kappa|Lambda|Mu|Nu|Xi|Omicron|Pi|Rho|Sigmaf|Sigma|Tau|Upsilon|Phi|Chi|Psi|Omega|alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigmaf|sigma|tau|upsilon|phi|chi|psi|omega|upsih|lsquo|rsquo|sbquo|ldquo|rdquo|bdquo|dagger|Dagger|bull|hellip|permil|prime|Prime|lsaquo|rsaquo|oline|euro|trade|larr|uarr|rarr|darr|harr|crarr|loz|spades|clubs|hearts|diams|forall|part|exist|empty|nabla|isin|notin|ni|prod|sum|minus|lowast|prop|infin|ang|and|or|cap|cup|int|sim|cong|asymp|ne|equiv|le|ge|sube|supe|sub|sup|nsub|oplus|otimes|perp|sdot)', '&$1;');
info(4+i,1)=strcat('<HTML>',T);
And to obtain max length of string in one column I use this:
d=max(cellfun('prodofsize',info(:,1)))
And result is for any example 93, because href = "HTML>I<SUB">HTML>I<SUB</a<FONT SIZE=-1>0</FONT></SUB>sin(ωt+φI<SUB><FONT SIZE=-1>0</FONT></SUB>)
In uitable there appears not &omega and &phi but omega and phi like greek letter, and not HTML>I<SUB<FONT SIZE=-1>0</FONT></SUB> but Io.
john
john 2013-9-23
Can any body help me?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by