Matlab tex file specify column delimiters

大憨熊 提交于 2020-01-03 03:31:06

问题


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?


回答1:


Use 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);


来源:https://stackoverflow.com/questions/23511579/matlab-tex-file-specify-column-delimiters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!