MATLAB Answers


How can I plot scatter graphs in a for loop?

Lala0099 님이 질문을 제출함. 11 Nov 2019 21:36
최근 활동 David Hill 님이 댓글을 추가함. 12 Nov 2019 14:09
I have a large data set. I am trying to use a for lop, to be able to select which coloumn i want to keep and which ones i want to discard, all depending on the user input.
I managed to do that part, i believe.
Now I am trying to get an average value for each coloumn and plot the results in a scatter graph. I tried to do this using a for loop.
But there is only one data set that appears on my scatter graph, so I assume it cancels the ones that were before that last point. I used hol all, hold on and draw now, but could not get it to work. Also I would like add a line of best fit for the scatter graph for each data set and save slope and intercept numbers in a table.
I managed to do do the line of best fit and slope, intercept before, but not since I am trying to use for loops, so I put my old code segments in a comented out section.
In the first version of the code, i just determined the coloumns ( channels ) i want to use in the code, not depending on user input.
I cannot upload the excel file that I use, because it is too big. i tried to compress, but did not work

  댓글 수: 0

로그인 to comment.

답변 수: 1

David Hill 님의 답변 11 Nov 2019 22:47

Assume you have your data in a matrix, M. Assume you want a scatter plot of the column vs. mean of each column.

  댓글 수: 2

but using this still does not make my graph of multiple data points in the same scatter in the for loop, but only of the last set
It plots the mean of each column on the scatter plot and does not need to be in any for-loop. If you want more points plotted on the scatter plot, then I really don't understand what you want.

로그인 to comment.

Translated by