rtsHSVtoRGB.m 522 Bytes
function RGBval = rtsHSVtoRGB(HSVval)

H = HSVval(1);
S = HSVval(2);
V = HSVval(3);

C = V*S;
Hprime = H/60;
X = C*(1 - abs(mod(Hprime, 2) - 1));

RGBval = [0 0 0];
if Hprime >= 0 && Hprime < 1
    RGBval = [C X 0];
end
if Hprime >= 1 && Hprime < 2
    RGBval = [X C 0];
end
if Hprime >= 2 && Hprime < 3
    RGBval = [0 C X];
end
if Hprime >= 3 && Hprime < 4
    RGBval = [0 X C];
end
if Hprime >= 4 && Hprime < 5
    RGBval = [X 0 C];
end
if Hprime >= 5 && Hprime < 6
    RGBval = [C 0 X];
end