Index out of bounds
2 ビュー (過去 30 日間)
古いコメントを表示
Hi guys,
I need your help once more!
The error is: index out of bounds because size(z)=[22719,1];
So this is my code where things go wrong:
X = [ones(M,1), z(:,t) z(:,t).^2];
and this is the error:
Attempted to access z(:,19); index out of bounds because size(z)=[22719,1].
Any help would be appreciated.
Thanks!
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 5 月 30 日
The problem is clear
The size of z is [22719,1], which means z(:, 19) does not exist
2 件のコメント
Azzi Abdelmalek
2013 年 5 月 30 日
Kevin's comment
Thanks for your reply Azzi.
So how should I adjust my code?
Azzi Abdelmalek
2013 年 5 月 30 日
編集済み: Azzi Abdelmalek
2013 年 5 月 30 日
Maybe this is what you want, but I'm not sure, you have to tell us.
X = [ones(M,1);z(t,1) ;z(t,1).^2];
その他の回答 (1 件)
参考
カテゴリ
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!