How create a calculator function ?
Mostrar comentarios más antiguos
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 comentarios
Guillaume
el 11 de Feb. de 2015
- Start your editor
- Write the code (read through your course notes)
- Save the file
More seriously, nobody is going to do your homework for you. If you have a specific problem, we'll be happy to help you, but you need to come back with a much narrower question and with details of what you've tried.
James Tursa
el 11 de Feb. de 2015
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.
Respuestas (2)
Rick Rosson
el 11 de Feb. de 2015
Here is a start:
function y = calculator(a,b,t)
% Insert your header comments here
%
%
% insert your MATLAB code here:
end
1 comentario
John D'Errico
el 11 de Feb. de 2015
Oh, gosh. That gives the whole thing away. :)
Categorías
Más información sobre Variables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!