Hello, my friend,
I learn this a few days ago. In order to gain Bonferroni p-value you should have STATS, you may not hear about STATS, STATS is a stats output structure from ANOVA2 (anova2) if A and B are normal, or KRUSKALWALLIS (kruskalwallis), or FRIEDMAN (friedman), if they are not normal.
So you need to perform one of these tests first and latter achieve Bonferroni p-value. But which one of anova2, kruskalwallis, or friedman you need to use? It depends on your purpose and also your data. I'm wanna tell you that if your data is normal then you can use anova2 family. And if your data is not normal you need to use kruskalwallis, or friedman tests.
But let's explain it for you as clear I can, Since you want to achieve Bonforini p-value, I can tell that you want to know if A and B have significant differences or not (in 0.05 significant level) so this is your purpose that I talk about it above. Now, what about your data? how do you can know whether your data are normal or not? I tell you, you need to conduct the Kolmogorov Smirnov test (kstest2) first. Then check if the null hypothesis rejects or not. If it's rejected you need to use kruskalwallis, or friedman tests (I recommend kruskalwallis).
In order to summarize this answer, I don't talk about the kstest2 and also the kruskalwallis test, if you look at the documentation of these two tests I'm sure you can do them.
Now, here an example:
A = rand(1000,1);
B = rand(1000,1);
AB = [A B];
[h, p, k2stat] = kstest(AB);
[p, tbl, stats] = kruskalwallis(AB);
c = multcompare(stats,'CType','bonferroni');
Now open c, the last column is the p-value of Bonforini. You said you need to check it at the 0.05 significance level. So since
0.4345>0.05 your null hypothesis is rejected (0.4345 is the p-value of Bonforini in this example).
If you wanted to check with 0.01 you can say since 0.4345>0.01 my null hypothesis rejects.
So dear Ahmed, here all things that I knew, I learned them in this week using documentation of Matlab, so I'm quite sure if you have any problem you may have your answer in the documentation. Also, I check this question if any other help I can provide for you, my friend.