Matlab tex文件指定列分隔符

时间:2014-05-07 07:36:09

标签: matlab replace latex delimiter text-processing

我在Matlab中创建一个tex文件。最终目标是使用latex创建一个pdf。我使用以下网站检查我的乳胶是否正确latex generator。从我有一个包含逗号的数字,例如5,236,012时,一切都很好。当我从tex文件中复制数据时出现问题。列分隔符设置为逗号,如何将其更改为分号?

1 个答案:

答案 0 :(得分:0)

使用strrep -

%%// input_filepath and output_filepath are the filepaths of the 
%%// input and output tex files

data = importdata(input_filepath);
datacell = strrep(data,',',';');

%%// Save as a text file
fid2 = fopen(output_filepath,'w');
for k = 1:size(datacell,1)
    fprintf(fid2,'%s\n',datacell{k,:});
end
fclose(fid2);