필터 지우기
필터 지우기

How do I add color to this line of code without repeating the time variable everytime?

조회 수: 1 (최근 30일)
plot(time,[accLong,accVert,accLat,],'linewidth',2) % plot all
I do not want to use this version
plot(time,accLong,'r',time,accVert,'b',time,accLat,'k','linewidth',2) % plot all

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 24일
Use plot handles to set the color
t = 1:10;
x1 = rand(size(t));
x2 = rand(size(t));
p = plot(t, [x1; x2]);
p(1).color = 'r'; % color of first line
p(2).color = 'b'; % color of second line
  댓글 수: 2
suleiman abdullahi
suleiman abdullahi 2020년 9월 24일
Thanks for the response, is there another way without creating the variable p?
Ameer Hamza
Ameer Hamza 2020년 9월 24일
I don't think there is an easy way. Any other solution will lead to more variables.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by