fprintf help needed with self create function

So i created a function called degreetoradian(angle) these are my working
angle=input('Please insert the angle you want in degree form'); fprintf('Your angle in radian is \n ')
how to include my self create function which is degreetoradian(angle) to my fprintf when it is display on the command window instead of having another answer appearing

 채택된 답변

Star Strider
Star Strider 2015년 3월 23일

0 개 추천

You need to put an edit descriptor in your fprintf call:
fprintf('Your angle in radian is %.3f\n ', radians)
Here, the edit descriptor is ‘%.3f’, producing a floating-point answer to three decimal places. Before that of course, you have converted the degree input to radians, and in this illustration, have named it ‘radians’. (Name it whatever you wish.)

댓글 수: 7

meaning i do this? radian=degreetoradian(angle)
then
fprintf('Your angle in radian is %.3f\n ', radians) ? i dont think its right, right? because im getting error
Im sorry its my fault my self build function have wrong variable. Thanks for your on two of my questions. Really appreciated it
My pleasure!
I apologise for my delay in replying — life intrudes.
do you mind if i asked u another question?
I don’t mind at all!
I’ll do my best to answer it.
I answered it, but I had to take a guess at the correct answer, because I don’t have your code for your ‘degreetoradian’ function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2015년 3월 23일

댓글:

2015년 3월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by