필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Manish  kumar
Manish kumar 2015년 4월 12일
댓글: Thomas Koelen 2015년 4월 13일
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
Geoff Hayes
Geoff Hayes 2015년 4월 12일
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 2015년 4월 13일
i got it..N_all should be vector for this. thanks

댓글을 달려면 로그인하십시오.

채택된 답변

Stalin Samuel
Stalin Samuel 2015년 4월 12일
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
Manish  kumar
Manish kumar 2015년 4월 13일
thanks a lot dear. It solved my problem....
Thomas Koelen
Thomas Koelen 2015년 4월 13일
So accept the answer?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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