Question: Use a for - loop to define a function to convert a text representing a binary number to decimal integer, and then test it as
Use a forloop to define a function to convert a text representing a binary number to decimal integer, and then test it as described below.
Write a userdefined MATLAB function named mybindec that takes one single valued text input argument representation of a binary number and converts it to a decimal integer. You are not allowed to use MATLAB bindec function in your function definition, but can use it to check whether your function works correctly.
Write a MATLAB script file that calls mybindec function and prints to the screen the values of binary numbers in the range of to ie to in decimal
Hint: you can use a for loop and the MATLAB function decbin to generate the binary numbers in the range specified above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
