【发布时间】:2014-02-02 13:37:48
【问题描述】:
我知道这是一个反复出现的话题,我已经尝试理解人们提供的答案,但似乎没有一个容易转移到我的特定问题上,因为解决方案通常是针对与我的实现相距甚远的实现努力去做
任何人都可以帮助解决以下问题。
当我运行下面的代码时,我得到:
Error using dlmwrite (line 118)
The input cell array cannot be converted to a matrix.
Error in GAVNeuroScan (line 25)
dlmwrite(outputfile, CondRowDone);
我在代码末尾给出了我想在 cmets 中实现的示例。
如果有人可以帮助我将 CondRowDone 的内容保存到文本文件中,如 cmets 所示,那就太好了!
studyname='TestGav';
subjects={'504','505'};
conditions={'HighLabel','LowLabel','HighSound','LowSound'};
nCond=4;
GFPorBMR='GFP';
for curCond=1:length(conditions)
for curSubject=1:length(subjects)
gavRow{curSubject}=[subjects(curSubject) '-' conditions{curCond} '-' GFPorBMR '.avg'];
end
CondRowDone{curCond,:}=['GROUPAVG' '{' gavRow '}' 'G Y 1 N N' conditions{curCond} 'avg.'];
end
outputfile = [studyname '_GAV_' curSubject '.txt'];
dlmwrite(outputfile, CondRowDone);
% What I want is a text file that would look exactly like that. I think I'm
% not far but it fails to write...
%
% GROUPAVG {{HighLabel-504-GFP.avg} {HighLabel-505-GFP.avg}} G Y 1 N N {HighLabel.avg}
% GROUPAVG {{LowLabel-504-GFP.avg} {LowLabel-505-GFP.avg}} G Y 1 N N {LowLabel.avg}
% GROUPAVG {{HighSound-504-GFP.avg} {HighSound-505-GFP.avg}} G Y 1 N N {HighSound.avg}
% GROUPAVG {{LowSound-504-GFP.avg} {LowSound-505-GFP.avg}} G Y 1 N N {LowSound.avg}
【问题讨论】:
标签: matlab cell-array