MATLAB: Output file .txt

convertimage processingtext file

I have converted a .png image and each pixel to 16 bits and I want to save these bits in .txt file,but when I save my output file,my text file show the in each line the first bits and in the seconde line the seconde bits of the first pixel…..there is my code:
i want my file to be: in each line 16 bits
[sourcepic,phatsource]=uigetfile('*.png','C:\Users\hp\Desktop\images brutes LST\images brutes png\T4');
A=imread('C:\Users\hp\Desktop\images brutes LST\images brutes png\T4.png');
C=imresize(A,[695 316]);
d=reshape(C,[],1);
R=de2bi(d,16);
fid = fopen('C:\Users\hp\Desktop\ K.txt', 'wt');
fprintf(fid,'%o\n',R)

Best Answer

yes sir that what i mean how i can verify that each bits of this image is truely converted to 16 bits? what i see its just add 0 to complet the 16 bits