How to scatter plot a cell array
Show older comments

I have a 1x18 cell array like the picture. The indices of the cells (1:18) represent the depths of my system. And each depth includes corresponding amount of data (for example, the 1st depth has 529 data). Now I want to plot these data as a function of depth. How can I achieve that? Should I use scatter function? But scatter function requires the length of x, y dimension to be same.
3 Comments
The cell array is 18x1, not 1x18.
"I want to plot these data as a function of depth"
Does that mean that you want there to be 18 values along the x axis (1:18) and for each x value, you want there to be a vertical stack of dots along the y axis? For example, at x=1, there would be 529 values of y. Is that your goal?
If you want lines that connect values between depths, you'll have to explain how 28 values at x=18 correspond to 93 values at x=17 etc.
Adam Danz
on 11 Feb 2020
Weihao Fan's answer moved here as a comment.
Yeah that is my goal. And what do you mean by explaining the correspondence between depths
" what do you mean by explaining the correspondence between depths"
As you can see in the demo in my answer, each stack of dots has a different number of dots. So, if you expected to see trend lines connecting the dots between x values, you'd need to explain how those values are related since there is not a 1:1 mapping.
Accepted Answer
More Answers (1)
Weihao Fan
on 12 Feb 2020
0 votes
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!