Hello everyone, I am loading three mat files into matlab but each time i want the color of the graph should be like red, green and blue. But at the moment, it is plotting all three in red color. Any help guys.
clear all;
close all;
clc;
datafiles={'data1.mat','data2.mat','data3.mat'};
for sno = 1:numel(datafiles)
load(datafiles{sno});
%%Blocking Probability graph
figure(2);
hold on;
grid on;
plot(offered_traffic,blocking,'r*','LineWidth',2,'markersize',8);
end

 채택된 답변

Star Strider
Star Strider 2015년 2월 7일

0 개 추천

Greetings again!
Add the ‘cv’ matrix, and change the plot call slightly:
cv = ['r*'; 'g*'; 'b*']; % Colour Vector
for sno = 1:numel(datafiles)
load(datafiles{sno});
%%Blocking Probability graph
figure(2);
hold on;
grid on;
plot(offered_traffic,blocking, cv(sno,:) ,'LineWidth',2,'markersize',8);
end
I can’t test it with your code, but I tested a version of it to be certain it works.

댓글 수: 3

Aftab Ahmed Khan
Aftab Ahmed Khan 2015년 2월 7일
편집: Aftab Ahmed Khan 2015년 2월 7일
Hi, The color is changed according to how i want them but the markers are not displaying on any graph, don't know why.
colors=['r*'; 'g^'; 'bo'];
Aftab Ahmed Khan
Aftab Ahmed Khan 2015년 2월 7일
Done, Solved. Thanks.
Star Strider
Star Strider 2015년 2월 7일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2015년 2월 7일

댓글:

2015년 2월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by