rgbconv.m

버전 1.0.0.0 (1.11 KB) 작성자: Rasmus Anthin
Convert hex color to or from MATLAB color vector. (with syntactic sugar).
다운로드 수: 4.6K
업데이트 날짜: 2003/12/29

라이선스 없음

I know this routine might be a clone. But the nifty thing with this is that you can enter the color code in many different formats as explained below.

It also senses what type of data you input wheter it is hexadecimal or if it is a MATLAB rgb vector, so you don't have to tell it which format you want to convert to!

Here comes the help section:
%%%%%%%%%%%%%%%%%%%%%%

RGBCONV Convert hex color to or from MATLAB rgb vector.
RGB = RGBCONV(HEX) where HEX is a string of hexadecimal numbers
'RRGGBB' where the parts RR, GG, BB are two digit hexadecimal
numberes corresponding to the strengths of the colors red,
green and blue. RGB is the matlab rgb-vector.
RGB = RGBCONV(HEX) where HEX is a string matrix of the form
['RR';'GG';'BB'], or a cell string {'RR','GG','BB'}, or
RGB = RGBCONV('RR','GG','BB')
[R,G,B] = RGBCONV(...) gives the corresponding matlab rgb-values
as scalar values in R, G and B correspondingly.

HEX = RGBCONV(RGB) where RGB is a matlab rgb-vector with
three elements each corresponding to strengs of
red, green and blue and ranging between 0 and 1.
HEX = RGBCONV(R,G,B) where R, G and B are scalar values
ranging between 0 and 1 each corresponding to red, green
and blue.
HEX is a string containing the hex values and is of length 6.
['RR','GG','BB'] = RGBCONV(...) gives the corresponding hex
values as two character strings 'RR', 'GG' and 'BB'

Examples:
rgbconv([.1 .2 .3])
rgbconv(.55,.6,.12)
[r,g,b]=rgbconv([.1 .2 .3])
rgbconv('1a334d')
rgbconv('1a','33','4d')
[r,g,b]=rgbconv({'F1','2A','55'})

See also COLORMAP.

인용 양식

Rasmus Anthin (2024). rgbconv.m (https://www.mathworks.com/matlabcentral/fileexchange/4265-rgbconv-m), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R10
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Language Fundamentals에 대해 자세히 알아보기
도움

도움 준 파일: Colormap Dropdown Menu, rgb2hex and hex2rgb

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

changed category.