fprintf help needed with self create function

1 回表示 (過去 30 日間)
Victor Seaw
Victor Seaw 2015 年 3 月 23 日
コメント済み: Star Strider 2015 年 3 月 23 日
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 日
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 件のコメント
Victor Seaw
Victor Seaw 2015 年 3 月 23 日
Star Strider
Star Strider 2015 年 3 月 23 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by