필터 지우기
필터 지우기

How to store data from second row &second column onwards

조회 수: 1 (최근 30일)
Kanakaiah Jakkula
Kanakaiah Jakkula 2015년 9월 25일
댓글: Kanakaiah Jakkula 2015년 9월 27일
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.

채택된 답변

the cyclist
the cyclist 2015년 9월 25일
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
Kanakaiah Jakkula
Kanakaiah Jakkula 2015년 9월 27일
Sir, It works, but can't I store in double format(is it due to lable, that it is stored in cell format)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Risk Management Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by