How to create a calculator?

25 次查看(过去 30 天)
Johnny Boy
Johnny Boy 2014-12-7
I'm trying to figure out how to program a user-friendly circuit calculator. It will be a basic series circuit (2 windows, with 1 resistor on the top of each window and 1 on each side at a maximum, so up to 4 resistors can be chosen). The user should be able to specify the number of resistors AND each of their values so ultimately the total resistance can be calculated. So far I have: menu('Number of resistors', '1', '2', '3', '4'). Clicking the number of choice indicates the user's number of resistors. Then, he/she would type in the values of those x number of resistors (no more than 4) so they can receive a calculation of the total resistance. The total resistance would be R1+R3+R3+R4 (if the user chooses 4 resistors). If they choose three, it would be R1+R2+R3.
  1 个评论
John D'Errico
John D'Errico 2014-12-7
So what is your question? That you WANT to do something is good. But there really is no way we can help you from what you have said. START WRITING. If we write something for you, you gain nothing.
You say that so far, you have ONE basic line of code. So spend some time thinking. What is your next step? How would you implement that? Try something. If it does not work, then read the help. Figure out why. It is that effort on your part that gives you a gain.
In the end, the goal is for you to learn programming, so that perhaps eventually you can use that skill to build something useful.

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2014-12-7
It seems that you want to create a GUI for your calculator. The best way to approach this is to start with guide. Take your time, experiment with it, and have fun!

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by