I am trying to save multiple png files of circles with different colours in MATLAB. I wish to have multiple files with the name:
RINGS_Base_<n><colorname>
n
being the number of different files displayed and colorname
being the name of the colour of the circle.
Since the circles have an RGB colour, I transformed each RGB colour into the actual name of the color by using the function translatecolor.
Can I call that function when I am naming each one of my files? If not, how can I name all of the files with their respective colours?
Thank you in advance for your help.
Here is my code:
RGB = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1];
%
%RIGNSGenerator_FilledCircle1
%
n=1;
for col1 = transpose(RGB)
FilledCircle1(2,2,5,300,transpose(col1)) %function []=FilledCircle1(x0,y0,Radius,N,col1)
print (strcat ('/Users/Stimuli_Rings/RINGS_Circle_', num2str(n),translatecolor(col1), '.png'), '-dpng') %strcat is to combining strings together
n=n+1;
end
function out=translatecolor(in) % translates the RGB colour into the actual name of the color
switch(in)
case [1 1 0], out='yellow';
case [1 0 1], out='pink';
case [0 1 1], out='cyan';
case [1 0 0], out='red';
case [0 1 0], out='green';
case [0 0 1], out='blue';
return;
end
end