Why options are not working in fracfract function?

10 views (last 30 days)
I follow the instruction and the function fracfact is not working.
My code :
gen1 = fracfactgen('a b c d e f g h',7,8);
[a1,confounding] = fracfact(gen1,'X1',3);
size(a1)
Matlab Instructions :
[...] = FRACFACT(GEN, 'PARAM1',val1, 'PARAM2',val2,...) specifies one
% or more of the following name/value pairs:
%
% 'MaxInt' Maximum level of interaction to include in the
% confounding output (default 2)
% 'FactorNames' Cell array specifying the name for each factor
% (default names are X1, X2, ...)
I got the following error :
Error message :
Error using fracfact (line 51)
Invalid parameter name: X1.
Error in Bending_F_Factorial_design (line 67)
[a1,confounding] = fracfact(gen1,'X1',3);
Best regards.

Answers (1)

Geoff Hayes
Geoff Hayes on 8 Jul 2014
In the function signature and after the GEN input, each new input is a name/value pair - 'PARAM1',val1, 'PARAM2',val2, etc. The PARAMX is one of MaxInt or FactorNames. So one of these two parameter names must precede the value.
I think that all you need to do is change your function call from
[a1,confounding] = fracfact(gen1,'X1',3);
to
[a1,confounding] = fracfact(gen1,'FactorNames',{'X1'},'MaxInt',3);
Note how the X1 string is wrapped in {}. This is because the value expected for the FactorNames parameter is a cell array.
Try the above and see what happens!

Products

Community Treasure Hunt

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

Start Hunting!