MSD
MSD

Reputation: 129

writing binary values into file in MATLAB

i was converting an image file into binary to process in VHDL. while i was converting image to binary and when writing that matrix into a text file unnecessary commas came between the number.I want a column vector.my input is a square matrix.all working well except the comma part.i am using dummy values.can anyone give any suggestions

a=[1 3;6 9];
b=dec2bin(a');
fName = 'output.txt';
fid = fopen('output.txt','w');
dlmwrite(fName, b);

but the output file was like this

0,0,0,1
0,0,1,1
0,1,1,0
1,0,0,1

i was expecting

0001
0011
0110
1001

Upvotes: 2

Views: 568

Answers (1)

P0W
P0W

Reputation: 47784

You have to pass '' as an delimeter . Ref:- dlmwrite usage

dlmwrite('output.txt', b, '')

Upvotes: 3

Related Questions