Output error in the grayscale

11 views (last 30 days)
Eva Comeni
Eva Comeni on 25 Feb 2022
Answered: yanqi liu on 26 Feb 2022
Hi have this code:
resRGB = HSVtoRGB(resHSV);
but i have this error:
Input error: please pass as input a vector variable with 3 elements with value in the range [0,1]
How do I have improve my code?

Answers (1)

yanqi liu
yanqi liu on 26 Feb 2022
yes,may be check the resHSV value,such as
resHSV = rand(10, 3)
resHSV = 10×3
0.7587 0.7579 0.0652 0.4818 0.0649 0.8844 0.0645 0.1354 0.6241 0.3727 0.3020 0.4130 0.3200 0.7897 0.9591 0.1881 0.8734 0.0345 0.5663 0.9280 0.7975 0.1788 0.2104 0.1991 0.9820 0.2493 0.1922 0.7460 0.6177 0.9019
size(resHSV)
ans = 1×2
10 3
rgb = hsv2rgb(hsv);
surf(peaks);
colormap(rgb);
colorbar

Community Treasure Hunt

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

Start Hunting!