Question: PLEASE HELP IN MATLAB Assume the variable NUMS is defined as a list of numbers. Write a code segment that utilizes a loop to total

PLEASE HELP IN MATLAB
Assume the variable NUMS is defined as a list of numbers. Write a code segment that utilizes a loop to total up all of the numbers in the list up to, but not including, the first positive number. Store the result in the variable NEGSUM.
% test cases % NUMS = [ -1, -4, -2, 1, 7, 9]; NEGSUM = -7; % NUMS = [ 1,-2,-3,-4]; NEGSUM = 0; % your code segment here %----------------------- % set the variable NEGSUM to be the sum of the all numbers in NUMS up to the first positive number
Notes:
- Your code must use a loop.
- You may assume that there is always a positive number in the list
- Your code must work for any valid list of numbers.
- Do not include any test cases in the code you submit.
(version 885) Assume the varlable NUMS Is defined as a llst of numbers. Write a code segment that utilzes a loop to total up all of the numbers In the list up to, but not Including the first positive number. Store the result in the variable NEGSUM % test cases %MMS- [ -1, -4, -2, 1, 7, 9]; NEGSUM % NMS- [ 1,-2,-3,-4]i NEGSUM- @i -7; % your code segment here % sat the variable NEGSUM to be the sum f tha all numbers in NUMS up to the first positive number Notes: Your code must use a loop. .You may assume that there is always a positive number in the list .Your code must work for any valld llst of numbers Do not include any test cases in the code you submit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
