- Start your editor
- Write the code (read through your course notes)
- Save the file
How create a calculator function ?
38 ビュー (過去 30 日間)
古いコメントを表示
Create a function calculator() that has as input: a: number; b: number; t: textfield containing the mathematical function to perform. The functions to calculate are: “+” “-“ “*” “/”. If another type of function is inputted (e.g. “^”) the output should be NaN. Tip: to verify a text you can use the function “strcmp”. You will also have to use an “if else” statement in your code. Create a proper header.
How do you do this?
3 件のコメント
James Tursa
2015 年 2 月 11 日
Contributors to this site are willing to help, but are generally not willing to do your homework for you. Please make an attempt and if you can't get it working, post your code and ask specific questions about your code and we will help.
回答 (2 件)
Rick Rosson
2015 年 2 月 11 日
Here is a start:
function y = calculator(a,b,t)
% Insert your header comments here
%
%
% insert your MATLAB code here:
end
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!