print leading and trailing zeros into text file
4 次查看(过去 30 天)
显示 更早的评论
hi I have this hex values 0BA12CE0 that I want to print to a text file ,uses these commands to do that :
fileID1 = fopen('enct40.txt','wt');
fprintf(fileID1,'%s\n',cd1);
fclosef(fileID1);
but when I open the text file the leading and trailing zeros are disappear like this 'BA12CE' how can I print the results as they are without any missing values ?
3 个评论
per isakson
2017-11-4
编辑:per isakson
2017-11-4
This works here on R2016a,Win7
cd1 = '0BA12CE0';
fileID1 = fopen('enct40.txt','wt');
fprintf(fileID1,'%s\n',cd1);
fclose(fileID1);
type enct40.txt
output
0BA12CE0
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!