Hi Ben!
It seems that you want to perform a two-way repeated measures ANOVA in MATLAB to analyze the effects of drug application on the firing responses of neurons across different current injections. You will need to structure your data appropriately and use the "fitrm" and "ranova" functions.
I have provided a sample MATLAB code that performs the ANOVA analysis on the given data:
% Read the data from the Excel file
filename = 'Data_anova.xlsx';
data = readtable(filename);
% Handle NaN values - for simplicity, removing any rows with NaN values.
data = rmmissing(data);
% Convert categorical variables
data.cell_ID = categorical(data.cell_ID);
data.condition = categorical(data.condition);
% Fit the repeated measures model without explicitly specifying 'WithinDesign'
rm = fitrm(data, 'x_20_,x_40_,x_60_,x_80_,x_100_,x_120_,x_140_~condition');
% Perform the repeated measures ANOVA
ranovatbl = ranova(rm);
% Display the results
disp(ranovatbl);
The above code demonstrates a simple approach for repeated measures ANOVA analysis. You can try modifying the above approach by reshaping the data table to have one data point in one row and performing two-way repeated measures ANOVA in MATLAB.
You can refer to the following documentations for more information:
I hope it helps!