structured array help

조회 수: 1 (최근 30일)
James
James 2011년 8월 21일
I have a 2x100 structured array
and I want to store and export the values in the 2nd row into Excel. How can I do this?
  댓글 수: 10
Fangjun Jiang
Fangjun Jiang 2011년 8월 21일
Please accept some of your questions. I believe they are answered. It's a conclude of the post as well as acknowledging that others did help to solve your problem.
Oleg Komarov
Oleg Komarov 2011년 8월 21일
I stopped answering this poster since he never shows:
- any sign of acknowledgment;
- improvement in the formulation of his questions
- understanding of the fact that an accepted answer is a reference/potential answer for other users as well.

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

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 8월 21일
%example data
a(2,9).field1='text'
a(2,9).field2=rand;
%code
prop=fieldnames(a);
N_prop=length(prop);
mat=cell(N_prop,size(a,2));
for k=1:N_prop
[mat{k,:}]=deal(a(2,:).(prop{k}));
end
xlswrite('test.xls',mat);
%if the data has only one field called .cdata
mat=cell(1,size(a,2))
[mat{1,:}]=deal(a(2,:).cdata);
xlswrite('test.xls',mat);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by