Why do I get Subscript indices must either be real positive integers or logicals?

This is my code, I keep getting this error in the first line.
%%% TDMA
T(1:n,0) = Tinf; aux(1:n,p) = T(:,p-1)
p=1;
Thanks!

2 Comments

You are trying to access column p-1 of matrix T. Since p=1, p-1=0. Matlab does not recognize an index of zero; Matlab indexing starts at 1.
Thank you very much. I have another problem. I'll post it here, I hope you can help me:
Attempted to access Q(6); index out of bounds because numel(Q)=1.
Error in ProgramaGiuliaL (line 76) T(i,p) = Q(i)+P(i)*T(i+1,p-1);

Sign in to comment.

 Accepted Answer

You are using zero as an index in
T(1:n,0) = Tinf.
Zero is not a positive integer.

1 Comment

Thank you very much. I have another problem. I'll post it here, I hope you can help me:
Attempted to access Q(6); index out of bounds because numel(Q)=1.
Error in ProgramaGiuliaL (line 76) T(i,p) = Q(i)+P(i)*T(i+1,p-1);

Sign in to comment.

More Answers (0)

Products

Tags

Asked:

on 18 Jun 2013

Community Treasure Hunt

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

Start Hunting!