MATLAB: How to convert a matrix into a number conversionmatrixmatrix manipulation suppose I have a matrix: matrix=[1 1 0 1 0 1 1] then I want it to be 1101011. I used mat2str, num2str but it didn't satisfied me. Thankyou! More power to you guys! Best Answer Use matstr = strrep(num2str(matrix),' ','') bin2dec(matstr) ans = 107 Related SolutionsMATLAB: Converting base 10 to base 2, dec2base help X = dec2base(4,2)whos X % X is a character array!fprintf('%g', X) % prints out ascii codes of the string!, Similar to ...fprintf('%g', 'hello') fprintf('%s', X) % use %s as a format string for character arrays MATLAB: Converting a Double into a Matrix of its Digits A = [ 123; 456; 789 ]B=num2str(A)-'0' Related QuestionHow to convert a cell containig 8bit niary sequence to integer valueHow to XOR binary matrixHow to convert ‘123’ to [1,2,3]Hello everyone. I converted 4 into binary and got 100 . the problem is that i want to use this 100 as a decimal but the matlab is obviously treating it as a binary number. Please help
Best Answer