Index in position 2 exceeds array bounds (must not exceed 1).

1 view (last 30 days)
Hi, I am running a code, however I keep getting error:
Can anyone help me fix this issue? Thank you.
title('Orignal Image' )
plot(NouN(100,:) )
  2 Comments
Adam Danz
Adam Danz on 5 Oct 2018
Nout is allocated with all 0s.
Nout=zeros(1,col);
Then in a loop, you do this calculation
for j = 1:col
...
Nout(1,j) = Nin(1,j)*exp(-A(1,j));
...
end
On each iteration of the loop, Nin(1,j) will always equal 0, no?

Sign in to comment.

Answers (1)

the cyclist
the cyclist on 5 Oct 2018
Edited: the cyclist on 5 Oct 2018
I can't be sure, but it looks like you've inadvertently defined Nin to just be a scalar:
Nin(1,:)=100000
Nin =
100000
So if you try to access Nin(1,2), it does not exist.

Categories

Find more on Numeric Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!