Why options are not working in fracfract function?

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.

답변 (1개)

Geoff Hayes
Geoff Hayes 2014년 7월 8일
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!

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

질문:

2014년 7월 8일

답변:

2014년 7월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by