0
我有一个daq卡,从中每隔100毫秒连续采集数据。现在我想创建一个包含所有数据的txt文件。这个txt文件还应该有一个时间戳 ,应该有5个列标题 - zeit,channel1,channel2 .... channel4。matlab导出数据
这是我可以编写的代码,但我很困惑如何在标题后打印数据。 同样在每隔100毫秒后新的数据进来,这必须附加到文件的末尾。时间戳是在一个特定的格式,因为以后我需要搜索一个数字。
% Time stamp
A = datestr(now, 'mmmm dd, yyyy HH:MM:SS.FFF ')
format short g
datevec(A)
fid = fopen('acq.txt','w');
fprintf(fid,'%s\t',A)
A = 'Zeit';
dataName = 'channel';
fid = fopen('acq.txt','w');
fprintf(fid,'%s\t',A)
%# loop to write the rest of the header
x=5
for iModel = 1:x
fprintf(fid,'%s_%i\t',dataName,iModel);
end
data = rand(10,10);
fprintf('acq.txt' , '%i' ,data);
Oki所以基本上你的意思是我需要一个循环,它首先写入标题,然后退出循环,然后写入数据,但我怎么知道数据正在正确的标题下写入时间戳。你能不能把前卫编排好。 – user664270 2011-03-21 12:52:04