print leading and trailing zeros into text file

조회 수: 10(최근 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
mia saam
mia saam 2017년 11월 4일
It's dec value=195112160 when I use dec2hex(195112160) the leading zero will disappear

댓글을 달려면 로그인하십시오.

채택된 답변

Cedric Wannaz
Cedric Wannaz 2017년 11월 4일
>> dec2hex(195112160, 8)
ans =
'0BA12CE0'
  댓글 수: 2
Cedric Wannaz
Cedric Wannaz 2017년 11월 4일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by