hi Matlab
i have done many time to used iteration for
i want to update value in nwc and hWW put it value from fm.WellModel
but always got errors message
nw = fm.getNumberOfWells(); %2
nwc=nan(nw,1);
hWW=nan(nw,1);
for i = 1:nw
wm = fm.WellModels{i}; %fm.WellModel consist of 2x1 cell array
W = wm.W;
wc = W.cells;
nwc(i)=numel(W(i).cells);
hWW(i)=W(i).hW;
Solving timestep 01/50: -> 2 Days
Index exceeds matrix dimensions.

댓글 수: 5

Geoff Hayes
Geoff Hayes 2019년 5월 27일
vaya - which line of code is generating the error? For which value of i?
vaya putra
vaya putra 2019년 5월 28일
when i = 1 is okay
but i = 2 is
Index exceeds matrix dimensions.
nwc(i)=numel(W(i).cells);
Shubham Gupta
Shubham Gupta 2019년 5월 28일
May I know what is stored in W ? What is the size of W ?
vaya putra
vaya putra 2019년 5월 28일
thank all, i already solved..
Raghunandan V
Raghunandan V 2019년 5월 28일
Please post the answer. It will help others

댓글을 달려면 로그인하십시오.

답변 (1개)

vaya putra
vaya putra 2019년 5월 28일

1 개 추천

by modify this script and its work
[nwc,hWW] =deal(nan(nw,1));
for i = 1:nw
wm = fm.WellModels{i};
W = wm.W;
wc = W.cells;
nwc(i)=W.cells;

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2019년 5월 27일

답변:

2019년 5월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by