Index in position 2 exceeds array bounds (must not exceed 14).
1 次查看(过去 30 天)
显示 更早的评论
C(1,1)= 1; C(1,10) =-1; C(1,16) = 1
C(2,2) = 1; C(2,10) = 1; C(2,11) =-1;
C(3,3) = 1; C(3,11) = 1; C(3,12) = -1;
C(4,4) = 1; C(4,8) = 1; C(4,13) = -1;
C(5,5) = 1; C(5,4) = 1; C(5,14) = -1;
C(6,6) = 1; C(6,8) = 1; C(6,9) = 1; C(6,15) = 1;
C(7,7) = 1; C(7,15) = 1; C(7,16) = -1;
C(8,8) = 1; C(8,17) = -1;
C(9,9) = 1; C(9,17) = 1;
----------------------------------------------------------------
>> C(9,17)
Index in position 2 exceeds array bounds (must not exceed 14).
0 个评论
回答(1 个)
Alan Stevens
2020-10-18
Odd! It works for me:
>> C(1,1)= 1; C(1,10) =-1; C(1,16) = 1;
C(2,2) = 1; C(2,10) = 1; C(2,11) =-1;
C(3,3) = 1; C(3,11) = 1; C(3,12) = -1;
C(4,4) = 1; C(4,8) = 1; C(4,13) = -1;
C(5,5) = 1; C(5,4) = 1; C(5,14) = -1;
C(6,6) = 1; C(6,8) = 1; C(6,9) = 1; C(6,15) = 1;
C(7,7) = 1; C(7,15) = 1; C(7,16) = -1;
C(8,8) = 1; C(8,17) = -1;
C(9,9) = 1; C(9,17) = 1;
>> C(9,17)
ans =
1
3 个评论
Alan Stevens
2020-10-18
I don't know! The only change I made was to put a semicolon after C(1,16), but I can't imagine that made a real difference!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!