How to wrote this matlab function without dec2bin for binary representation?
Write a function with the following header: function [representations] = my_binary_detector(binary, integer) where: _binary is 1_n row vector of class char (i.e. a character string with n characters) that contains only zeros (character '0') and/or ones (character'1'). You can assume that n > 1. _integer is a scalar of class double that represents an integer (positive, negative, or zero). _representations is a 1_m cell array (with m 6 3) that contains 0, 1. 2, or all 3 of the following character strings: _'unsigned'. representations should contain the character string 'unsigned' if and only if the binary representation described by the input parameter binary is the un-signed n-bit binary representation of the number described by the input parameter integer. _'signmagnitude'. representations should contain the character string 'signmagnitude' if and only if the binary representation described by the input parameter binary is the sign-magnitude n bit binary representation of the number described by the input parameter integer. _'twoscomplement'. representations should contain the character string 'twoscomplement' if and only if the binary representation described by the input parameter binary is the two's complement n-bit binary representation of the number described by the input parameter integer. 4 If representations contains more that one character string, then the character strings should be ordered in alphabetical order. If representations does not contain any values, its size should be 0_0, not 1_0. You can create a 0_0 cell array using the syntax {} (i.e., curly braces without anything in between). You may not use Matlab's built-in functions sort, bin2dec dec2bin, hex2dec, dec2hex, hex2num, num2hex, base2dec, and dec2base in this question. Test cases: >> representations = my_binary_detector('11001011', 203) representations = cell 'unsigned' >> representations = my_binary_detector('01001011', 75) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned' >> representations = my_binary_detector('1111', 7) representations = 0 times 0 empty cell array >> my_binary_detector('0111', 7) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned' >> representations = my_binary_detector('0000000000', 0) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned' Write a function with the following header: function [representations] = my_binary_detector(binary, integer) where: _binary is 1_n row vector of class char (i.e. a character string with n characters) that contains only zeros (character '0') and/or ones (character'1'). You can assume that n > 1. _integer is a scalar of class double that represents an integer (positive, negative, or zero). _representations is a 1_m cell array (with m 6 3) that contains 0, 1. 2, or all 3 of the following character strings: _'unsigned'. representations should contain the character string 'unsigned' if and only if the binary representation described by the input parameter binary is the un-signed n-bit binary representation of the number described by the input parameter integer. _'signmagnitude'. representations should contain the character string 'signmagnitude' if and only if the binary representation described by the input parameter binary is the sign-magnitude n bit binary representation of the number described by the input parameter integer. _'twoscomplement'. representations should contain the character string 'twoscomplement' if and only if the binary representation described by the input parameter binary is the two's complement n-bit binary representation of the number described by the input parameter integer. 4 If representations contains more that one character string, then the character strings should be ordered in alphabetical order. If representations does not contain any values, its size should be 0_0, not 1_0. You can create a 0_0 cell array using the syntax {} (i.e., curly braces without anything in between). You may not use Matlab's built-in functions sort, bin2dec dec2bin, hex2dec, dec2hex, hex2num, num2hex, base2dec, and dec2base in this question. Test cases: >> representations = my_binary_detector('11001011', 203) representations = cell 'unsigned' >> representations = my_binary_detector('01001011', 75) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned' >> representations = my_binary_detector('1111', 7) representations = 0 times 0 empty cell array >> my_binary_detector('0111', 7) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned' >> representations = my_binary_detector('0000000000', 0) representations = 1 times 3 cell array 'signmagnitude' 'twoscomplement' 'unsigned