How to display more than 3 elements per column using the Matlab "table" command?

11 vues (au cours des 30 derniers jours)
bayleaf
bayleaf le 13 Mai 2015
Modifié(e) : bayleaf le 14 Mai 2015
When using the table command in Matlab, variables with a vector size bigger than 3 would not be displayed in the table with their actual values. Instead I get something like [1x4 double].
Please see this Matlab help example, I adapted to show my issue:
Case with vector length in variable "BloodPressure" = 3 (output displayed as "124 93 1" - the values I'm looking for)
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 2; 109 77 2; 125 83 2; 117 75 2; 122 80 2222222222];
T = table(Age,Height,Weight,BloodPressure,...
'RowNames',LastName)
Command window:
T =
Age Height Weight BloodPressure
___ ______ ______ _______________________________
Smith 38 71 176 124 93 2
Johnson 43 69 163 109 77 2
Williams 38 64 131 125 83 2
Jones 40 67 133 117 75 2
Brown 49 64 119 122 80 2.2222e+09
Case with vector length in variable "BloodPressure" = 4 (output displayed as [1x4 double] - this is not of use for me)
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 1 2; 109 77 1 2; 125 83 1 2; 117 75 1 2; 122 80 1 2222222222];
T = table(Age,Height,Weight,BloodPressure,...
'RowNames',LastName)
Command window:
T =
Age Height Weight BloodPressure
___ ______ ______ _____________
Smith 38 71 176 [1x4 double]
Johnson 43 69 163 [1x4 double]
Williams 38 64 131 [1x4 double]
Jones 40 67 133 [1x4 double]
Brown 49 64 119 [1x4 double]
Any hints and help much appreciated!

Réponses (1)

Peter Perkins
Peter Perkins le 13 Mai 2015
bayleaf, there's not currently any way to do that, other than splitting the four (or more) columns into separate variables in the table.
Can you say more about what you're doing, and why?
  1 commentaire
bayleaf
bayleaf le 14 Mai 2015
Modifié(e) : bayleaf le 14 Mai 2015
Hi Peter, using the table command I thought I found an easy and neat way to compare my outputs from some optimisation algorithms (the table would include variables such as initial parameters, iterations, performance, output values etc). So depending on the starting conditions and dimensions I'm looking at, the length of some of the vector variables varies.
I assume, splitting the four (or more) columns into separate variables would mean to modify the code depending on the number of dimensions I'm applying for the particular problem? Would there be an alternative way to solve the problem?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by