str2rgb

版本 1.0.0.0 (1.7 KB) 作者: Kenneth Eaton
Converts a string representation of a color to an RGB triple
1.6K 次下载
更新时间 2008/4/3

查看许可证

A simple utility to convert a ColorSpec value, represented as a string, to a numeric RGB triple. This function does not use eval. One possible use is for reading a user-entered color value from an editable text box.

Examples:
str2rgb('yellow') returns [1 1 0]
str2rgb('y') returns [1 1 0]
str2rgb('[1 1 0]') returns [1 1 0]
str2rgb('1 1 0') returns [1 1 0]
str2rgb('[1; 1; 0]') returns [1 1 0]
str2rgb('[0 0.5 0.91]') returns [0 0.5000 0.9100]
str2rgb('purple') returns NaN
str2rgb('[1 2]') returns NaN

引用格式

Kenneth Eaton (2024). str2rgb (https://www.mathworks.com/matlabcentral/fileexchange/19432-str2rgb), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R14SP3
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0