fprintf without empty lines
显示 更早的评论
Hi everybody,
I have some trouble with fprintf. I want to save a single line of characters in a txt-file. Later on I want to save another single line (chars again) in the same file. But there should not be any empty lines between nonempty lines in the end.
But in the way I coded my function, fprintf exports three empty lines after each line of chars. Even if I use the control characters '\n' or '\r\n' to start a new line.
Does someone know how to fix this?
Here is my code:
filename_user_AWG = [pwd '\resource\txt\user_AWG.txt'];
output = cell2table(AWG_out_str);
writetable(output, filename_helperfile, 'Delimiter', ';', 'WriteVariableNames', false, 'WriteRowNames', false);
fid = fopen(filename_helperfile, 'r');
tempfilecontent = fread(fid,'*char')';
fclose(fid);
fid = fopen(filename_user_AWG, 'at');
fprintf(fid, '%s', tempfilecontent);
fclose(fid);
Greetings, Stefan
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!