getting this error
1 回表示 (過去 30 日間)
古いコメントを表示
??? Index exceeds matrix dimensions.
Error in ==> C:\Documents and Settings\krishnendu\Desktop\Chared ICA Code\CreateInitialEmpires.m
On line 4 ==> AllImperialistsCost = InitialCost(1:AlgorithmParams.NumOfInitialImperialists,:);
by using the code
AllImperialistsCost = InitialCost(1:AlgorithmParams.NumOfInitialImperialists,:);
AlgorithmParams.NumOfInitialImperialists=2;
initialcost is a matrix like [1 2 3 4 5]
where is the error?
X(1:2,:);
what does it mean?
0 件のコメント
採用された回答
Andreas Goser
2012 年 1 月 31 日
This may be a confusion with rows and columns. E.g. this code here fails:
a=[1 2 3 ]
a(1:2, :)
Beacuse a is an 1x3 matrix and a(1:2, :) tries to access a nonexisting second row.
0 件のコメント
その他の回答 (1 件)
Walter Roberson
2012 年 1 月 31 日
X(1:2,:) means to take all columns of the first two rows of X.
Your initialcost matrix has only one row, so it is an error to try to take the first two rows of it since the second row does not exist.
Consider the possibility that your initialcost matrix should have at least 2 rows.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!