Parfor "Index exceeds Matrix Dimension"
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to do the following. I am repeatedly getting the error message as "Index exceeds Matrix Dimensions". I am not able to figure out why. The variable can be declassified also. Here is my code.
i = 1;
Pv = linspace(10,1000,100); Mrc = 9; Vdiscc = 0.000125;
HEDc(1,1:100) = 318; Cpw = 4.179; dfc = linspace(0,0,100);
parfor j = 1:1:100
for r = 1:1:100
hf = interp1(WPresSat(:,1),WPresSat(:,7),Pv(1,j));
hfg = interp1(WPresSat(:,1),WPresSat(:,8),Pv(1,j));
dfc(j,:) = (HEDc(i,:)*Cpw-hf)/hfg;
if dfc(j,:) < 0
dfc(j,:) = 0;
end
end
end
2 commentaires
Walter Roberson
le 14 Oct 2015
Caution:
if dfc(j,:) < 0
is only true if all dfc(j,:) < 0 .
Consider using
dfc(j,:) = max(0, dfc(j,:));
Réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!