Best way to display a group of arrays as a table?

19 vues (au cours des 30 derniers jours)
MersennePrime
MersennePrime le 17 Fév 2016
Modifié(e) : per isakson le 17 Fév 2016
I have an assignment, and the output has to look like the one below. I have already finished all the code that will create the arrays and store the generated values into them, now all I need to do is put them in a table similar to the picture. Does anyone know what the easiest way to go about doing this would be? In a way that lets me display it like it does below while also being able to choose what the headers on the top row are because the name of my arrays are not the same as what is displayed on the top row. Thanks for the help!

Réponses (1)

per isakson
per isakson le 17 Fév 2016
Modifié(e) : per isakson le 17 Fév 2016
"put them in a table " &nbsp on screen or to a text file?
If this format is good enough
T =
Gender Age State Vote
______ ___ _____ _____
M 45 'NY' true
F 32 'CA' false
M 34 'MA' false
then the easiest way is to use table, Create table from workspace variables
If not fprintf( 1, ... ) fprintf, Write data to text file

Catégories

En savoir plus sur Tables 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