1

Consider the following table in Matlab

LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
T = table(Age,Height,Weight,BloodPressure,'RowNames',LastName)

If I try to create uitable as follows, I receive error

uit = uitable('Data', T)

Although the following works: (Except: BloodPressure Variable should occupy two columns)

TVN = T.Properties.VariableNames;
TRN = T.Properties.RowNames;
TData = T{:,:};
uit = uitable('Data', TData, 'ColumnName', TVN, 'RowName', TRN);

I want to know, Is there a shorter or direct way of doing this?

I am using R2014a.

Thanks

pkj
  • 559
  • 1
  • 9
  • 21
  • It seems like there is no more direct way than the one you use, and there's also no quick solution for multi-column headers (like 'BloodPressure'). I hope someone will come with a new idea. – EBH Oct 17 '16 at 18:44
  • @EBH thanks for replying – pkj Oct 18 '16 at 12:33

0 Answers0