MATLAB Answers

Undefined function or variable for struct variable

4 views (last 30 days)
raha ahmadi
raha ahmadi on 7 Feb 2021
Commented: raha ahmadi on 7 Feb 2021
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 Comments

Sign in to comment.

Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!