Scatter Plot Vectors of Different Lengths

조회 수: 41(최근 30일)
Sclay748 2020년 8월 13일
편집: Sclay748 2020년 8월 13일
Hello, I am trying to make a scatterplot for some data. The data is a bit more complicated and large, so I have recreated a sample below on a smaller level for the sake of understanding what I am trying to do.
I have 3 experiments that each have data from 4-6 trials. I get an error that the vector size must be the same when I use the scatter function.
Experiment 1 Data (in seconds) [ 33, 43, 45, 34]
Experiment 2 Data (in seconds) [ 44, 47, 43, 48, 49, 46]
Experiment 3 Data (in seconds) [ 54, 47, 56, 57, 49]
I want the X axis to show Experiment 1, 2, 3 and the Y axis to show time with the points scattered based on their time in seconds while staying within their respective experiment group on the x axis.

채택된 답변

Hayden Garmon
Hayden Garmon 2020년 8월 13일
편집: Hayden Garmon 2020년 8월 13일
Does this work?
vec1= [ 33, 43, 45, 34];
vec2= [ 44, 47, 43, 48, 49, 46];
vec3= [ 54, 47, 56, 57, 49] ;
hold on
legend('Exp 1','Exp 2','Exp 3')
  댓글 수: 1
Sclay748 2020년 8월 13일
It works. Thanks so much!

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by