How do i extract data from each group separately and plot

U have attached the excel spreadsheet to this document and i want to extract the data from the Time course of logmIKI f(mean and s.e.m.) for each group separately, overlaping in the same figure. PLEASEEE HELP!
Thank you in advance

 採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 15 日

0 投票

filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/965825/advancedstats2.csv';
t = readtable(filename);
t.Properties.VariableNames
ans = 1×4 cell array
{'subj'} {'group'} {'trial'} {'logmIKI'}
G = findgroups(t.group);
output = splitapply(@(subj, group, trial, logmIKI) {table(subj, group, trial, logmIKI)}, t, G)
output = 3×1 cell array
{6480×4 table} {6480×4 table} {3600×4 table}
output{1}(1:10,:)
ans = 10×4 table
subj group trial logmIKI ____ _____ _____ _______ 38 0 1 NaN 38 0 2 6.561 38 0 3 6.158 38 0 4 6.5119 38 0 5 NaN 38 0 6 NaN 38 0 7 NaN 38 0 8 NaN 38 0 9 6.3263 38 0 10 6.2817

5 件のコメント

Savannah Britto
Savannah Britto 2022 年 4 月 15 日
編集済み: Savannah Britto 2022 年 4 月 16 日
THANK YOU!
Image Analyst
Image Analyst 2022 年 4 月 15 日
Exactly what are you trying to plot? What are the x values, and the y values?
You can't just string together three parentheses expressions like that
stackedplot ((output{1}(1:6480,:)(output{2}(1:6480,:)(output{1}(1:3600,:))
Try assigning each to some variable:
y1 = output{1}(1:6480,:)
y2 = output{2}(1:6480,:)
y3 = output{3}(1:3600,:)
Then use in stackedplot() and be sure to use commas between separate arguments.
Savannah Britto
Savannah Britto 2022 年 4 月 15 日
編集済み: Savannah Britto 2022 年 4 月 16 日
Walter Roberson
Walter Roberson 2022 年 4 月 16 日
stackedplot() does not offer any way to plot with different sizes of variables.
Savannah Britto
Savannah Britto 2022 年 4 月 16 日
編集済み: Savannah Britto 2022 年 4 月 16 日
how can i do it ?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by