The function HEX2RGB(HEX) converts a hexadecimal color string HEX to its corresponding RGB values. The RGB matrix has three columns representing the red, green, and blue components of the color. For a cell array of color strings, the number of rows in RGB will match the number of elements in the cell array. For a character array HEX, the number of rows in RGB will match the number of entries in HEX. Hexadecimal color strings can also be expanded from three-digit to six-digit by doubling each digit (i.e., XYZ -> XXYYZZ).
Examples:
- hex2rgb('556b2f') % 6-digit string -> [85 107 47]
- hex2rgb('f0f') % 3-digit string -> [255 0 255]
- hex2rgb({'8B4513','FF0'}) ?ll array -> [139 69 19; 255 0]
- hex2rgb(['FF6347'; '40E0D0']) % Multi-line character array -> [255 99 71; 64 224 208]