将sensor.SMAC_coef中的数据以列形式存储为excel
%读取各字段名称,存储为行格式,输出表头
>> names=fieldnames(sensor.SMAC_coef);
>> headers=names';
>> xlswrite(['header.xls'],headers);
%将struct转换为cell,struct中字段数为49
>> b=struct2cell(sensor.SMAC_coef); % b值为49*1 cell
output=[];
for i=1:49 %循环cell中数组
t=(b{i,1});tem=t'; %读取各字段数据转置为列
output=cat(2,output,tem); %输出数据列叠加
xlswrite(['out.xls'],output); %写出excel
end
output:
输出表头excel
输出数据excel,每个字段存储为1列