Index out of bounds

조회 수: 2 (최근 30일)
Kevin van Berkel
Kevin van Berkel 2013년 5월 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!

채택된 답변

Azzi Abdelmalek
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
Azzi Abdelmalek 2013년 5월 30일
Kevin's comment
Thanks for your reply Azzi.
So how should I adjust my code?
Azzi Abdelmalek
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개)

Kevin van Berkel
Kevin van Berkel 2013년 6월 1일
Works now. Thanks Azzi!

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by