Matlab 写入csv文件中的特定单元格

Matlab 写入csv文件中的特定单元格,matlab,csv,Matlab,Csv,我需要编写一个包含如下标记的单元格数组: 开始:结束:开始:结束:开始:结束: 进入csv文件中的特定行和列,但当我使用以下内容时: csvwrite(fName, tag(3), 4,0) START: 2013-05-04 19:13:06.188 ENDED: 2013-05-04 19:22:41.617 START: 2013-05-04 19:25:52.382 ENDED: 2013-05-04 19:35:27.827 . . . 它将每个字母写入单独的单元格,并覆盖现有数据

我需要编写一个包含如下标记的单元格数组:

开始:结束:开始:结束:开始:结束:

进入csv文件中的特定行和列,但当我使用以下内容时:

csvwrite(fName, tag(3), 4,0)
START: 2013-05-04 19:13:06.188
ENDED: 2013-05-04 19:22:41.617
START: 2013-05-04 19:25:52.382
ENDED: 2013-05-04 19:35:27.827
.
.
.
它将每个字母写入单独的单元格,并覆盖现有数据(标记(3)是cell类型的向量)

任何帮助都将不胜感激

这是代码的简要版本:

data = importdata('samplelog', ' ');


for i=1:length(data)
    % Extracting the tags 
    [start_i, end_i] = regexp(data{i}, '\D+:');
    tag{i} = data{i}(start_i:end_i);
end

fName = 'mem.csv';
fid = fopen(fName, 'w+');

csvwrite(fName, tag(3), 4, 0);
其中samplelog类似于:

csvwrite(fName, tag(3), 4,0)
START: 2013-05-04 19:13:06.188
ENDED: 2013-05-04 19:22:41.617
START: 2013-05-04 19:25:52.382
ENDED: 2013-05-04 19:35:27.827
.
.
.
使用,您只需调用
cell2csv('mem.csv',tag)
,它会将单元格数组
tag
写入逗号分隔值文本文件
mem.csv

:

我必须在这里复制许可证,对不起:

Copyright (c) 2004-2010, Sylvain Fiedler
All rights reserved.

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are 
met:

    * Redistributions of source code must retain the above copyright 
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright 
      notice, this list of conditions and the following disclaimer in 
      the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGE.

您是否尝试过
标记{3}
?是的,结果是一样的!您能否再添加一点代码,以便我们可以直接运行您的代码?单元格
标记(3)
包含什么?标记(3)包含数据类型单元格的“START:”。