我有一个单元格数据结构,我正在尝试将其打印到一个文件中,我一直收到此错误: 使用fprintf时出错 没有为“单元格”输入定义函数。
solWT = optimizeCbModel(recon1,'max','one');
fileID = fopen('Q3.txt','w');
grRateWT = solWT.f
C=cell(2,2);
for system = 1:2%length(recon1.subSystems)
system
fluxReactions = recon1.rxns(ismember(recon1.subSystems,recon1.subSystems(system)));
for reaction = 1:length(fluxReactions)
model = recon1;
model.lb(reaction) = 0;
model.ub(reaction) = 0;
end
solKO = optimizeCbModel(model,'max');
C{system, 1} = recon1.subSystems(system);
C{system, 2} = solKO.f / grRateWT;
end
sortedCellArray = sortrows(C,2);
formatSpec = '%s %2.1f\n';
[nrows,ncols] = size(C);
for row = 1:nrows
fprintf(fileID,formatSpec,sortedCellArray{row,:});
end
我做错了什么
答案 0 :(得分:0)
尝试
fprintf(fileID,formatSpec,sortedCellArray{row,1}, sortedCellArray{row,2})