can not update value

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 comentarios

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

Iniciar sesión para comentar.

Respuestas (1)

vaya putra
vaya putra el 28 de Mayo de 2019

1 voto

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;

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Etiquetas

Preguntada:

el 27 de Mayo de 2019

Respondida:

el 28 de Mayo de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by