# bin2text for MATLAB (Octave)

MATLAB, Octave @ 30 October 2010

Write binary numbers to a file. This is helpful if you want to test your VHDL code with numbers generated by Matlab.

function [] = bin2text(a,hedef)
% bin2text(a,hedef)
% a : the array of binary numbers
% hedef : the target file name
fid = fopen(hedef,'wt');
len = length(a(:,1));
for ii = 1:len
    fprintf(fid, '%s\n',a(ii,:));
end
fclose(fid);

Leave a Reply

*