comparison general/numerical/binary.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
comparison
equal deleted inserted replaced
3:3f77126f7b5f 4:e44f49929e56
1 % binary - return array contain binary sequece over N columns
2 %
3 % binary :: N:natural -> [[2^N,N]->{0,1}].
4 %
5 % note: returns an array of uint8
6
7 function B=binary(N)
8
9 M=2^N;
10 B=zeros(M,N,'uint8');
11 b=1:N;
12 for i=1:M
13 B(i,:)=bitget(uint32(i-1),b);
14 end