In order to find the p-value in Matlab, you can perform a hypothesis test using the pvalue() function from the Statistics and Machine Learning Toolbox. Here is an example:
main.m152 chars9 lines
In this example, we have two samples of data (x and y) and we want to test if they have the same mean. The ttest2() function performs a two-sample t-test and returns a logical variable h indicating if the null hypothesis should be rejected, and the p-value in variable p. You can access the p-value by simply printing the value of p.
gistlibby LogSnag