MATLAB: How to get the p-value as an output of fitlm

fitlmlinearoutputpp-valueregressionvalue

Hi,
I'm trying to isolate the p-value from the output of the fitlm function, to put into a table. I have 180 regressions to get the p-value for, so manually copying and pasting isn't practical.
I have managed to do this for the R-squared value using the following:
mdl = fitlm(x,y);
p_val = mdl.squared.Ordinary;
Does anyone know how to do the same for the p-value?
Thanks!

Best Answer

Try this:
p_val = mdl.Coefficients.pValue;
That will give you the p-values of the coefficients (from the t-statistic).