Ploting multiple traces with different colors. plot(x,y, 'color', 'red') not working
Show older comments
I am reading data from a folder with 9 s2p files that have S21 data that I am trying to plot. There are 3 temperatures I measured at and it is noted in the file name and is successfully sorted out. My issue is I want each temperature to have it's own color on the plot. My error is only present when I try to add color. I get the error "Error using rfdata.data/calculate>checkopcondition (line 1008) red is not a valid parameter or format."
the variable "data" is a single data variable and I am using the plot to just plot the S21 parameters
Why is the color not working?
for i=1:length(fileNames)
name = fileNames{i};
data = read(rfdata.data,name);
%custom adjustments for temperature
temp50 = '50C';
temp75 = '75C';
temp100 = '100C';
if contains(name,temp50)
legend_name_real(i) = strcat(legend_name_real(i), temp50);
plot(data, 's21', 'db','color', 'yellow');
elseif contains(name,temp75)
legend_name_real(i) = strcat(legend_name_real(i), temp75);
plot(data, 's21', 'db','color', 'orange');
elseif contains(name,temp100)
legend_name_real(i) = strcat(legend_name_real(i), temp100);
plot(data, 's21', 'db','color','red');
else
legend_name_real(i) = strcat(legend_name_real(i), ' room temp');
plot(data, 's21', 'db','color', 'green');
end
title('Title name');
hold on
end
legend(legend_name_real);
legend
Accepted Answer
More Answers (0)
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!