Matlab tex文件指定列定界符 [英] Matlab tex file specify column delimiters
本文介绍了Matlab tex文件指定列定界符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Matlab中创建一个tex文件.最终目标是使用乳胶创建pdf.我已经使用以下网站来检查我的乳胶是否正确乳胶生成器.当我有一个包含逗号的数字(例如5,236,012)时,一切都很好.当我从tex文件复制数据时,问题就来了.列分隔符设置为逗号,如何将其更改为分号?
I am creating a tex file in Matlab. The end goal is to create a pdf using latex. I have using following website to check the latex I have is correct latex generator. Everything is fine about from when I have a number that contains comma's for example 5,236,012. The issue comes when I copy the data from the tex file. The column delimiter is set to Commas, how can I change this to Semicolon?
推荐答案
使用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);
这篇关于Matlab tex文件指定列定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文