How to scatter/plot a vector vs a cell array ?

12 views (last 30 days)
I have a vector w such that
I use this vector to get values saved in a cell array. such that for each element of w, I get 1,2, or 3 values stored in one cell as a vector.
as an example:
w=[0, 0.1, 0.2, 0.3, ....]
cellArray= {[3, -4, 5], [1], [-2], [3,3], ...}
I want to plot this such that w is the x axis and the corresponding values on the y axis?
Nora Khaled
Nora Khaled on 15 Mar 2020
Thank you so much!
The code works perfectly.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 12 Mar 2020
w=[0, 0.1, 0.2, 0.3];
cellArray= {[3, -4, 5], [1], [-2], [3,3]};
hold on % important
arrayfun(@(i)plot(w(i),cellArray{i}, '-o'), 1:numel(w))

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!