# Matlab solution for DR and RD. Urgent help !

Hi i need to write Matlab solution for the function DR that ask for angle in degrees and computes the equivalent radians, and another function RD that ask for angle in radians compute the equivalent degrees. And my function should be able to accept both scalar and matrix input.
The script should keep running until no number is provided to convert.
[The function[b] isempty[/b] will be useful here]

This what i write on Matlab

clear,clc

function output = DR(x)
%This function changes degrees to radians
output = x*pi/180;

function output = RD(x)
%This function changes radians to degrees
output = x*180/pi;

selection = input ('Enter 1 for Degrees to Radians or Enter 2 for Radians to Degrees')
output = input (' Enter the number for calculation ' )

if selection = 1 then
output = DR(x)
else
if selection = 2 then
output = RD(x)
end
end

• You have to change this line:
[code]output = input (' Enter the number for calculation ' )[/code]
with this:
[code]x = input (' Enter the number for calculation ' )[/code]

and, at the end of the code:
[code]display(output);[/code]