フィルターのクリア

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{:});
  1 件のコメント
Stephan
Stephan 2020 年 12 月 7 日
Great! Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by