Effacer les filtres
Effacer les filtres

Index out of bound error in Matlab code ...Plz help....

1 vue (au cours des 30 derniers jours)
Manish  kumar
Manish kumar le 12 Avr 2015
Commenté : Thomas Koelen le 13 Avr 2015
Error is :- ??? Attempted to access N_all(2); index out of bounds because numel(N_all)=1.
Below is my code....
clc
clear all
close all
pause(0.05)
N_all=[100];
Eb_no=[0:2:20];
for ii=1:length(Eb_no)
N=N_all(ii)
end
  2 commentaires
Geoff Hayes
Geoff Hayes le 12 Avr 2015
Manish - you've initialized N_all as a scalar and yet your code is trying to use it as an array…and so the error messages makes sense. What are you attempting to do?
Manish  kumar
Manish kumar le 13 Avr 2015
i got it..N_all should be vector for this. thanks

Connectez-vous pour commenter.

Réponse acceptée

Stalin Samuel
Stalin Samuel le 12 Avr 2015
clc
clear all
close all
pause(0.05)
N_all=[1:100];
Eb_no=[0:2:20];
for ii=1:length(Eb_no)
N=N_all(ii)
end
  2 commentaires
Manish  kumar
Manish kumar le 13 Avr 2015
thanks a lot dear. It solved my problem....
Thomas Koelen
Thomas Koelen le 13 Avr 2015
So accept the answer?

Connectez-vous pour commenter.

Plus de réponses (0)

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