필터 지우기
필터 지우기

how to concatenate the two variables.?

조회 수: 12 (최근 30일)
sandy
sandy 2014년 3월 13일
댓글: Mischa Kim 2014년 3월 13일
how to concatenate the two variables a(1*5) cell and b(3*5) double
ex:
a= ch1_01 ch1_02 ch2_01 ch2_02 ch3_01
b=
12.2172 83.1253 32.3429 73.2126 43.3222
32.2179 13.1213 42.3388 53.5127 52.1229
82.2571 43.1231 52.1400 33.4129 44.3326
output: in one variable as
ch1_01 ch1_02 ch2_01 ch2_02 ch3_01
12.2172 83.1253 32.3429 73.2126 43.3222
32.2179 13.1213 42.3388 53.5127 52.1229
82.2571 43.1231 52.1400 33.4129 44.3326

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 13일
편집: Mischa Kim 2014년 3월 13일
Sandy, you could do:
a = {'ch1_01' 'ch1_02' 'ch2_01' 'ch2_02' 'ch3_01'};
b = [12.2172 83.1253 32.3429 73.2126 43.3222;...
32.2179 13.1213 42.3388 53.5127 52.1229;...
82.2571 43.1231 52.1400 33.4129 44.3326];
c.col = a;
c.val = b;
To access the different components use, e.g.,
c.col(2)
c.val(1:2,2:3)
  댓글 수: 2
sandy
sandy 2014년 3월 13일
thanks..how to save this structure variable as an excel file??
Mischa Kim
Mischa Kim 2014년 3월 13일
This should do:
filename = 'testdata.xlsx';
sheet = 1;
xlswrite(filename,c.col,sheet,'A1')
xlswrite(filename,c.val,sheet,'A2')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by