Y data addition on scatter plot
조회 수: 2 (최근 30일)
이전 댓글 표시
i am plotting a scatter plot X= [ 2 ,3,4,5] Y=[10,20,30,40] scatter(X,Y) i am looking for putting y values on the scatter plot...any specific code or hint can anyone help.i am using 2016b version.Thank you in advance.
댓글 수: 1
Voss
2022년 1월 17일
Well, the code - as you have it now - works:
X= [ 2 ,3,4,5]
Y=[10,20,30,40]
scatter(X,Y)
채택된 답변
Voss
2022년 1월 17일
You need to convert those cell arrays to numeric matrices before you can plot them (scatter or otherwise):
X= { 2 ,3,4,5}
Y={ 10,20,30,40}
scatter(cell2mat(X),cell2mat(Y))
추가 답변 (1개)
Cris LaPierre
2022년 1월 17일
편집: Cris LaPierre
2022년 1월 17일
Use square brackets to define vectors, not curly braces. You might find MATLAB Onramp helpful, especially chapters 2, 4 & 9. Also, capitalization matters in MATLAB. X is not the same variable as x.
X= [2,3,4,5];
Y=[10,20,30,40];
scatter(X,Y)
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!