I have no idea how to do this
이전 댓글 표시
My professor just started going over programming in MATLAB however he is not doing anything close to a good job of explaining it. my current assignment is
Given the array Y from the last homework assignment. Write a program that will add the terms of the array, one at a time, until the total is equal to or greater than 3500. Out put the value of the last element that was added.
Y = [95 93 69 75 74 88 83 91 90 78 89 88 86 79 80 55 32 100 97 81 70 ...
75 77 96 83 86 74 91 89 92 79 70 83 88 91 100 76 41 73 71 79 94 ...
105 92 89 89 87 66 94 97 92 78 84 89 ]
I have absolutely no idea how to go about this and i have no experience with programming. Does anyone know how to do this?
댓글 수: 5
Jan
2012년 9월 29일
Your professor knows this forum also. If you want to criticize him, I suggest to do this personally, but not in a public forum.
Image Analyst
2012년 9월 29일
Have you taken any programming at all before? Adding (accumulating) something in a loop is reall, really basic stuff and is almost the same in every language, so you'd already know that if you took any kind of programming course at all before now. To get out of a loop, you call "break" - just like you do in C and some other languages. The "if" test you'll use is also pretty much the same except that there are no parentheses needed around the condition, and there is nothing to start the block, like no "{" or no "then" or no "begin" needed. And all loops end with the same single word "end".
Matt Fig
2012년 9월 29일
There is a little button that looks like this '{} Code' please highlight your code and the press that button in the future. Thanks!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!