Index exceed matrix Dimensions error

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Zaz Pourghazi
Zaz Pourghazi 2021๋…„ 8์›” 14์ผ
๋Œ“๊ธ€: Walter Roberson 2021๋…„ 8์›” 14์ผ
Hi friends, I have an optimization model that I am going to get the optimal answer with the genetic algorithm, one of our cost semesters is as follows:
Cost of transporting packs from warehouses to tents: โˆ‘โˆ‘โˆ‘ ๐ถ๐ต(n, j, k) ๐‘ƒ๐ต(n, j, k). Which I wrote in MATLAB as follows :
pop(it,np).cost.term3=0;
for n=1:N
for j=1:J
for k=1:K
pop(it,np).cost.term3=pop(it,np).cost.term3+pop(it,np).arthvar.PB(n,j,k). *CB(n,j,k);
end
end
end
Now the problem is that MATLAB gives this error. While the dimensions of the matrix are the same and when I turn.* to * again, it gives an error, while when I copy my matrix in the Command Window and execute this loop, it resolves without any error while it is not in the code.
  ๋Œ“๊ธ€ ์ˆ˜: 1
Walter Roberson
Walter Roberson 2021๋…„ 8์›” 14์ผ
At the command window command
dbstop if error
when it stops, ask
[it, np, n, j, k]
size(pop)
size(pop(it,np).arthvar.PB)
size(CB)

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (0๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Genetic Algorithm์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by