Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to Have an ANSWER that would depend upon the LETTER of your INPUT? Plz help me. thank you

1 回表示 (過去 30 日間)
Kaye Freyssinet  Abanggan
Kaye Freyssinet Abanggan 2016 年 9 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
This is for Celsius to Fahrenheit and vise versa. how to have a Fahrenheit answer if I input Example: 32 C? This is my code and i dont have any idea how. =( thanks for the help in advance
A=input('input:'); if A=input('##F') F=1.8*C+32 elseif A=input('##C') C=(F-32)*5/9 end
  3 件のコメント
Kaye Freyssinet  Abanggan
Kaye Freyssinet Abanggan 2016 年 9 月 15 日
This is for Celsius to Fahrenheit and vise versa. how to have an answer that would depend on the letter ?
A=input('input:'); if A=input('##F') F=1.8*C+32 elseif A=input('##C') C=(F-32)*5/9 end
Steven Lord
Steven Lord 2016 年 9 月 15 日
A couple of functions or keywords that may be of use to you are isequal, switch and case, lower, and/or upper.

回答 (1 件)

Renato Agurto
Renato Agurto 2016 年 9 月 15 日
編集済み: Renato Agurto 2016 年 9 月 15 日
Here is a little help
function output = your_function(str)
unit = str(end); %should be 'F' or 'C'
val = str2double(str(1:end-1)); %should be a number
%Your computation comes here:
% output = ....
end

Community Treasure Hunt

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

Start Hunting!

Translated by