2

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
1
  • Check fwrite. Commented Aug 16, 2013 at 10:40

1 Answer 1

3

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

dlmwrite('output.txt', b, '')
Sign up to request clarification or add additional context in comments.

2 Comments

but the values are changed..now its displaying 0001 0010 0110 1101
@user2689061 ahh, sorry I took transpose of b (b'), updated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.