How to define LineSpec in one variable?
46 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Stephan
am 7 Dez. 2020
Kommentiert: Stephan
am 7 Dez. 2020
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);
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 7 Dez. 2020
LineSpec = {'Color','black','LineWidth',2};
plot([1,2],[1,2],LineSpec{:});
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!