Octave - array to number -


i have array a=[0 1 0 1 1 0] , turn content of array number ( a=010110 ). how do that?

and to opposite: if have number b=100101, array a=[1 0 0 1 0 1]

thanks help

not elegant, go matrix number:

a = [1 0 1 1 0 1]; = mat2str(a);                                % returns '[1,0,1,1,0,1]' = strrep(substr(a, 2, numel(a)-2), ',', ''); % remove ','  ,  '['  ,  ']' = str2num(a);                                % convert number                                

number matrix:

a = 110011001; = num2str(a, 1000000)-'0'; 

where 1000000 precision octave using when converting number string. needs large enough accommodate numbers converting.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -