I have a piece of code and I want to use the map() in order to have the last column of the array with values between 5 and 60. 5 will equal to the minimum value and 60 to the maximum, and the numbers in the middle they will follow a linear relationship with the previous rule.
My question is, how can I transform all the numbers of the last column of the array using map()? I was thinking in using a loop, first I have found the maximum and minimum values of the column and now I don’t know how to transform the rest. I use the float a later.
int max = cities[0][2];
int min = cities[0][2];
for (int j=1; j<cities.length; j++){
if (cities[j][2] < min){
min=cities[j][2];
}
if(cities[j][2] > max){
max=cities[j][2];
}
float a= map(j, min, max, 5, 60);
...
}