MATLAB: How to run a loop for variables satifying a specific condition and multiply them by values stored in a matrix

for loopindexingvariableswhile loop

i need to create a NEW vector in which, starting from the condition that SP > 0 i can create a new vector. In detail want to skip the first line, then I want to multiply SP by 0.1 (position h+1), then 0.4 for h+2, then 0.5 for h+3 , summing the corresponding delta. You can see an example in the figure attached.
Anyone can help me?
I attached my data
Thanks in advance!

Best Answer

I recommend you spend some time going through MATLAB Onramp. It's interactive, and you can go at your own pace. Oh, and it's free.
In particular, focus on
  1. Chapter 4 - vectors and matrices
  2. Chapter 5 - indexing
  3. Chapter 6 - array calculations
  4. Chapter 11 - importing data
  5. Chapter 12 - programming (incorporating conditional logic (if statement) and looping (for loop)