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

5 ビュー (過去 30 日間)
Nora Khaled
Nora Khaled 2020 年 3 月 12 日
コメント済み: Adam Danz 2020 年 3 月 15 日
Hello,
I have a vector w such that
w=0:0.1:5
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?
  4 件のコメント
Nora Khaled
Nora Khaled 2020 年 3 月 15 日
Thank you so much!
The code works perfectly.

サインインしてコメントする。

採用された回答

Adam Danz
Adam Danz 2020 年 3 月 12 日
w=[0, 0.1, 0.2, 0.3];
cellArray= {[3, -4, 5], [1], [-2], [3,3]};
figure()
hold on % important
arrayfun(@(i)plot(w(i),cellArray{i}, '-o'), 1:numel(w))
  3 件のコメント
Adam Danz
Adam Danz 2020 年 3 月 15 日
Glad I could help!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by