Where are the functions fpval and chi2pval in the builtin function canoncorr.m

4 views (last 30 days)
I am using the standard Matlab function canoncorr.m to calculate canonical correlations between two large data sets. However, I get error messages on lines 145 and 149. This error also appears with basic random 3x9 matrices for both x and y.
line 145: stats.pF = fpval(stats.F, stats.df1, stats.df2);
line 149: stats.pChisq = chi2pval(stats.chisq, stats.df1);
they both throw an error of "function not defined for argument of type double"
then if I search for them or try to find help files I get "function not found" errors.
I fear the files were overwritten but I cannot even seem to find them on other computers with matlab in order to replace them on my machine.
Perhaps parts of my path were inadvertently deleted?
Does anyone know the location of these built in files? Any help would be greatly appreciated.

Accepted Answer

Star Strider
Star Strider on 7 Aug 2014
They may have been overshadowed with other functions or variables with the same names, but you likely didn’t delete them.
In the Command Window, type:
which fpval -all
which chi2pval -all
I get as the result:
C:\Program Files\MATLAB\R2014a\toolbox\stats\stats\private\fpval.m % Private to stats
C:\Program Files\MATLAB\R2014a\toolbox\stats\stats\private\chi2pval.m % Private to stats
If you get more than that (for the MATLAB version you have), you need to track down the shadowing variables or functions and rename them. It’s probably best to do this just after you get the error, with any potentially problematic functions or variables still in your workspace so you can detect them.
  2 Comments
Alex
Alex on 7 Aug 2014
Thanks for the prompt reply! I took your advice and saw only the same answer, but it turns out that I had overshadowed the statstoolbox canoncorr.m, thereby denying access to the private functions. Now everything works fine! I think I must have edited canoncorr.m accidentally.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!