how to put heading for columns of matrix?

129 views (last 30 days)
suvadip paul
suvadip paul on 4 Oct 2013
Commented: Busra Unlu on 3 Jan 2021
I want to put a heading for each column of a output matrix like
I J K
2 3 4
4 5 4
3 8 7

Answers (3)

Azzi Abdelmalek
Azzi Abdelmalek on 4 Oct 2013
h={'I' 'J' 'K'}
A= [2 3 4;4 5 4;3 8 7]
M=[h;num2cell(A)]
  5 Comments

Sign in to comment.


Jonathan Sullivan
Jonathan Sullivan on 4 Oct 2013
If you have MATLAB 2013b, I would look into using tables
doc table
  2 Comments
Jonathan Sullivan
Jonathan Sullivan on 7 Oct 2013
No but earlier versions of MATLAB have datasets in the statistics toolbox. They provide similar functionality.
doc dataset

Sign in to comment.


anahita ahrari
anahita ahrari on 6 Jun 2018
how can i add titles to a column in matlab ?

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by