Undefined function or variable for struct variable
조회 수: 4 (최근 30일)
이전 댓글 표시
I have defined 'createModel' function but when I call struct variables from command window , for example
model.pmin(5) or unifrnd(pmin,pmax)
I get this error:
Undefined function or variable 'pmin'.
My code was attached. I have searched some similar questions but I cant solve yet. I really appreciate any help
Thanks in advance
Raha
function model=createModel ()
pmin=[553 782 502 781 608 461 553 699];
pmax=[2078 1907 1864 1562 1982 1437 1626 2138];
N=numel(pmin);
PL=10000;
a0=[7349 7737 6566 8530 9045 7502 6903 9809];
a1=[8 5 5 5 6 9 8 7];
a2=[-0.1817 -0.1010 -0.1395 -0.2037 -0.2740 -0.2296 -0.2540 -0.1358]*1e-4;
model.pmin=pmin;
model.pmax=pmax;
model.N=N;
model.PL=PL;
model.a0=a0;
model.a1=a1;
model.a2=a2;
end
댓글 수: 2
Stephen23
2021년 2월 7일
It works for me:
S = createModel();
S.pmin(5)
function model=createModel ()
pmin=[553 782 502 781 608 461 553 699];
pmax=[2078 1907 1864 1562 1982 1437 1626 2138];
N=numel(pmin);
PL=10000;
a0=[7349 7737 6566 8530 9045 7502 6903 9809];
a1=[8 5 5 5 6 9 8 7];
a2=[-0.1817 -0.1010 -0.1395 -0.2037 -0.2740 -0.2296 -0.2540 -0.1358]*1e-4;
model.pmin=pmin;
model.pmax=pmax;
model.N=N;
model.PL=PL;
model.a0=a0;
model.a1=a1;
model.a2=a2;
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!