Displaying a color gamut surface -- Old Code does not work in r2021b ?

2 views (last 30 days)
As I tried to step through the code, I stumbled on this error :
Error in Z_Boundary_sRGB (line 13)
trisurf(k,a,b,L,'FaceColor','interp','FaceVertexCData',rgb,'EdgeColor','none')
The web site page, down in the comment section, refers to a 'fix' for 2014b and later :
set(groot,'DefaultFigureColormap',map)
Since I'm using R2021b, I figured I'll add the code but I still got the error. I'll keep searching at my end... but here's, in case...
[r,g,b] = meshgrid(linspace(0,1,50));
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb);
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
trisurf(k,a,b,L,'FaceColor','interp','FaceVertexCData',rgb,'EdgeColor','none')
xlabel('a*')
ylabel('b*')
zlabel('L*')
axis([-110 110 -110 110 0 100])
view(-10,35)
axis equal
title('sRGB gamut surface in L*a*b* space')
I get the concept of a 3D boundary but I confess I'm at loss as to explain what's going on in the trisurf function.
Any help is appreciated :-)

Answers (1)

Roger Breton
Roger Breton on 19 Dec 2021
Edited: Roger Breton on 19 Dec 2021
Never mind! I inadvertently saved a snippet of code under the name trisurf.m in the current directory. So when Matlab executed the script, of course, MY trisurf.m function took precedence ove the built-in, "real" trisurf.m function. Egg on my face... I'll learn to better read error messages in the future... Needless to say, as soon as I renamed my code snippet, the script worked flawlessly, as it pulled the "original" trisurf code...
Boy! Let that be a lesson...

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!