필터 지우기
필터 지우기

How to define LineSpec in one variable?

조회 수: 22 (최근 30일)
Stephan
Stephan 2020년 12월 7일
댓글: Stephan 2020년 12월 7일
Hello everyone,
I would like to specify the line properties in one variable. For example, the code
plot([1,2],[1,2],'Color','black','LineWidth',2);
should be replaced by a code of the form (which produces an error):
LineSpec = {'Color','black','LineWidth',2};
plot([1,2],[1,2],LineSpec);
Thanks for any help!
plot([1,2],[1,2],'Color','black','LineWidth',2);

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 7일
LineSpec = {'Color','black','LineWidth',2};
plot([1,2],[1,2],LineSpec{:});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by