필터 지우기
필터 지우기

Adding more colors to my array

조회 수: 1 (최근 30일)
u-will-neva-no
u-will-neva-no 2012년 7월 11일
Hey everyone, i have an array of colors and would like to add more. I currently have:
plot_type = ['r'; '-g'; '-b'; '-c'; '-m';'-k'];
and would like to have something like:
plot_type = ['-r';'-b';'-g';'-g';'-y';'-k';'-m';'-.r';'-.b';'-.g';'-.y';'-.k';'-.m';'-.p';'-.c';'-g';'-y'];
but matlab does not like it. Any other way of doing the latter? thanks!
  댓글 수: 3
u-will-neva-no
u-will-neva-no 2012년 7월 12일
Thanks John that helped. The only other chanhe I made was to create two seperate matrix. Matlab didnt like having different numbers of columns which is understandable.
Jan
Jan 2012년 7월 12일
"Matlab does not like it" is not really helpful. When you explain a problem, adding the complete error message and the line, which causes the error is recommended.

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

채택된 답변

Doug Hull
Doug Hull 2012년 7월 12일
You might want to look into he ColorOrder and LineStyleOrder properties. It seems you might be trying to do somethign where that would be helpful.
I personally, would also consider using a cell array to hold all those plot_types. I am uncomfortable having an array of strings, since they get padded to be all the same length. You are not running into any problems here, but cell array of strings is a better general pattern for this.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by