フィルターのクリア

plot values of same index from two vectors

2 ビュー (過去 30 日間)
Nona
Nona 2021 年 6 月 14 日
コメント済み: Nona 2021 年 6 月 14 日
I have three vectors with the same amount of elements (pre values and post values of all participants, respectively and control data)
I would like to create a plot of the individual change, so x-axis = pre, post, control, y-axis = value of vector index and then plot the first index of the vector pre together with the first index of the vector post and so on while control data is seperate in the third 'column'. I can't figure out how to do this.
It should look something like this at the end.
  1 件のコメント
Megumi Fukuda
Megumi Fukuda 2021 年 6 月 14 日
Can you clarify the struture of your data and what you want to do? I assume you have three vectors (v_pre, v_post, and v_cont) without any missing data, and v_pre(1), v_post(1), and v_cont(1) is the pre data of participant1. What do you mean by "while control data is seperate in the third 'column'"? Is it graphical representation of the graph (i.e. no lines between v_post and v_cont)?

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

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 6 月 14 日
編集済み: Scott MacKenzie 2021 年 6 月 14 日
Here's what I put together. It looks a bit crazy because the data are just random numbers. But, I think it achieves more or less what you are after, given your example plot.
n = 8; % number of participants
x = 4; % number of data points: pre1, pre2, post1, post1
% test data (replace with your data)
data = rand(x,n) * 100;
control = rand(1,n) * 100;
plot(1:x, data, '-o');
hold on;
plot(x+1, control, 'ok', 'markerfacecolor', [.4 .4 .4]);
ax = gca;
ax.XLim = [0 6];
ax.YLim = [0 120];
ax.XLabel.String = 'Condition';
ax.XTickLabel = { '' '1Pre' '2Pre' '1Post' '2Post' 'Control' ''};
  1 件のコメント
Nona
Nona 2021 年 6 月 14 日
Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by