Effacer les filtres
Effacer les filtres

How to store data from second row &second column onwards

1 vue (au cours des 30 derniers jours)
Kanakaiah Jakkula
Kanakaiah Jakkula le 25 Sep 2015
I have a matrxi as below:
Data
1 2 3
3 4 5
6 7 8
But I have column names (&rows names same as column names)
A B C and I want to store my out put as below:
A B C
A 1 2 3
B 3 4 5
C 6 7 8
I am unable to store to like this.Kindly help me, many thanks in advance.

Réponse acceptée

the cyclist
the cyclist le 25 Sep 2015
Here is one way:
data = [1 2 3; 3 4 5; 6 7 8];
label = {'A','B','C'};
labelAndData = cell(4,4);
labelAndData(1,2:4) = label;
labelAndData(2:4,1) = label';
labelAndData(2:4,2:4) = num2cell(data)
  1 commentaire
Kanakaiah Jakkula
Kanakaiah Jakkula le 27 Sep 2015
Sir, It works, but can't I store in double format(is it due to lable, that it is stored in cell format)?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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