I have a
[2001,2] matrix of (x,y) values, but the number of rows could vary.
I would like to go through the entire matrix, and divide each of the y values by a certain number, depending on their x value.
For example, for x values from 600-700, I would like to divide the corresponding y value by 10. For x values from 700-800, I would like to divide the corresponding y value by 20.
My idea was a for loop that looped the entire matrix, and then nested "if" statements that said
if data[[n, 1]] < 700, data[[n, 2]] = data[[n, 2]]/10 if data[[n, 1]] >= 700 && data[[n, 1]] <800, data[[n, 2]] = data[[n, 2]]/20
However, I can't even figure out how to determine the number of rows in a matrix to ensure I loop the correct 2001 times (I want my code to work for any length).
Dimensions[data] doesn't help and
Length[Dimensions[data]] doesn't do it either and neither does