How can I break up a long line of code into multiple lines? I don't want to break up my plot, I just want to make this long line of code easier to read and edit. The ultimate goal is to have a plot that displays 4 sets of data on the same x-y axis, using different shapes with different colors for each data set.
figure
plot(Dates, PW_4anom,' bd', 'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'r', Dates, MW1_78anom, 'rs', 'MarkerEdgeColor', 'k'...
The code goes on to specify two more data sets. How can I write this code in multiple lines instead of one long line? Or is this the only way with the method I'm using?
I appreciate any and all help, I am totally new to Matlab!

 채택된 답변

Jan
Jan 2021년 3월 28일
편집: Jan 2021년 3월 28일

0 개 추천

The marker for the line continuation in Matlab is "..." :
figure
plot(Dates, PW_4anom, ' bd', ...
'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'r', ...
Dates, MW1_78anom, 'rs', 'MarkerEdgeColor', 'k');
You can find such information by asking an internet search engine for "Matlab line continuation".

댓글 수: 1

Molly Autery
Molly Autery 2021년 3월 28일
Thank you! I had tried using '...' but I kept getting errors. I just tried using 'hold on' with new plot commands and it seems to work also.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2021년 3월 28일

댓글:

2021년 3월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by