Index out of bounds

2 vues (au cours des 30 derniers jours)
Kevin van Berkel
Kevin van Berkel le 30 Mai 2013
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!

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 30 Mai 2013
The problem is clear
The size of z is [22719,1], which means z(:, 19) does not exist
  2 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 30 Mai 2013
Kevin's comment
Thanks for your reply Azzi.
So how should I adjust my code?
Azzi Abdelmalek
Azzi Abdelmalek le 30 Mai 2013
Modifié(e) : Azzi Abdelmalek le 30 Mai 2013
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];

Connectez-vous pour commenter.

Plus de réponses (1)

Kevin van Berkel
Kevin van Berkel le 1 Juin 2013
Works now. Thanks Azzi!

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by