uitable ColumnFormat for n columns

7 vues (au cours des 30 derniers jours)
Kaila
Kaila le 27 Jan 2012
I am new to Matlab and have a question regarding uitable 'ColumnFormat'. I would like to format all the column data in my uitable to 2 decimal places via format bank. How do I accomplish this if my data has n columns? I have the following code to create the table:
table = uitable(f,'data',cpf,'Position',[40 20 1000 770],'ColumnName',WOBvect,'ColumnFormat',columnformat,'RowName',Nvect);
I would like columnformat to be a vector of the size of WOBvect such that every element of the array, cpf, displayed in the uitable has 2 decimal places. I realize 'bank' may accomplish this, but how do I apply that to each column WITHOUT having to list the column names. The number of columns will vary with the size of WOBvect.
Thank you in advance!

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Jan 2012
Before that call,
columnformat = repmat({'bank'}, length(WOBvect), 1);

Plus de réponses (1)

Kaila
Kaila le 28 Jan 2012
THANK YOU! I am fairly new to MatLab and my programming skills are lacking. You have saved me hours of agonizing pain trying to figure this out! I had to slightly modify your suggestion as WOBvect is a row vector. Nevertheless, success!

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by