RGB triple of color name, version 2 does not work with Matlab2023

Hi i am very new to matlab and was looking for ways to introduce more color range rather than just the predefined colors, i stumbled upon an answer in this communitty where someone told to use 'RGB triple of color name, version 2' from filexchange. The syntax i used to define color was like
s.LineProperties(9).MarkerEdgeColor=rgb('stone') % plots a dark silver color.
but as i am now trying to use online version of Matlab which is 2023, it doesnt recoginze the word 'stone' for instance or any other combination of words like it use to in 2022 version .with version 2022 i could simply write rgb('dark green') and it would plot this color. Is there any way around in version 2023 because i have used that function in many scripts and it would take a huge amount of time to undo all of them.

 Risposta accettata

In MATLAB Online, open the Add-Ons Explorer (the icon that looks like three cubes in the Environment section of the Home tab of the toolstrip.) Search for and add this add-on to your MATLAB Online then you should be able to use it just like you have been in your desktop installation.

8 Commenti

It is already installed in the online version also. If not, it will not recognize it in the first place. With version 2023 it doesnt accept the value i provide to it into parenthesess. It functions, if i just provide simple color name, for eg rgb('red') but nothing like combination of words like dark blue, blood orange etc. In version 2022 it worked flawlessly. I have to access the online version quite often lately and this issue is becoming quite the headache.
What happens when you enter those "combination of words"?
  • Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
  • Does it do something different than what you expected, like give you a different color? If so, what did it do and what did you expect it to do?
At a quick glance at the source code (assuming you're using this File Exchange submission) I wouldn't expect specifying the colors with spaces in the names to work. None of the names in the getcolors() local function include spaces and the code that determines to which color the name you entered corresponds doesn't include any space removal functions.
% k = find(strcmpi(s, name));
% if isempty(k)
% error(['Unknown color: ' s]);
% else
% rgb = num(k(1), :);
% end
I would expect 'darkblue' to work, or 'darkorange', or 'orangered'. But the word 'blood' doesn't appear in the function so I think asking for the color 'blood orange' never should have worked.
strcmpi('darkblue', 'dark blue')
ans = logical
0
Or perhaps you were using a different File Exchange submission in the earlier release, one that does recognize the color 'blood orange'?
The color blood orange do works in 2022 version and spaces also work. For instance the word 'stone' it gives dark silver color but for now it gives error 'error using rgb, unknown color: stone. The warning is in red color. In 2022 version when i tried 'navy blue' color it suggested that this color does not exist and suggested me a different combination of blue which i dont remember right now, the point is in 2022 version the function had more depth to it. I recently installed 2022 version on differnt machine and the file exchange version for rgb triplet, the color names work in that version also with spaces too, so it could not be that i have different version of file exachnge on both systems.
It sounds like you might have a differnent function with the same name.
The function name RGB seems to be popular for such functions.
Stephen23's suspicion sounds quite reasonable. Let's make sure you're calling the rgb function you think you are. What does this function call return?
which -all rgb
the online version of matlab returns the value as MATLAB Add-Ons/Functions/RGB triple of color name, version 2/rgb.m. Will update here once i have access to the desktop version.
on my desktop version i got two outputs
\AppData\Roaming\MathWorks\MATLAB Add-Ons\Functions\RGB triple of color name, version 2\rgb.m % Shadowed
\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Climate Data Toolbox for MATLAB\cdt\rgb.m
seems like the suspicion was correct.
I installed the climate data tool box for online version also but it is shadowed now. How to unshadow the climate box plugin in this case ?

Accedi per commentare.

Più risposte (0)

Prodotti

Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by