After starting to create R-G-B equations in order to solve my problem, and getting frustrated, I managed to find a function that somebody had produced on stack exchange which solved this issue. Here is the link:
The function is called 'vals2Colormap', and it is part of this package.
Here is my specific usage:
colourMin = min(rectanglesWithValue(:,3));
colourMax = max(rectanglesWithValue(:,3));
[colouring, ~, ~] = vals2Colormap(elementToLinkToColorMap,[colourMin colourMax],'cool', [colourMin colourMax]);
Best Answer