index must be positive integer or logical

1 view (last 30 days)
I am getting the above mention error while running my code. Help me how to fix this. for your information "length of tua=61" or tua= -15:0.5:15
Attempted to access T(61,0); index must be a positive integer or logical.
Error in phatLoc (line 17) T(length(tau),end) = 0;
Error in messl>initIpd (line 276) tauPosInit = phatLoc(lr, tau, I, 0, vis);
Error in messl (line 126) [ipdParams itds] = initIpd(I, W, Nrep, tau, sr, lr, tauPosInit, pTauIInit, ...
Error in Main (line 68) [m,p] = messl(lr, tau, 2, 'vis', 1);

Accepted Answer

KSSV
KSSV on 9 Oct 2018
Edited: KSSV on 9 Oct 2018
Note that...MATLAB indices are always positive integers.......the indices start from 1....you are trying to access a index with 0..this is not correct.
A = rand(10,1) ;
A1 = A(1) % this gives first element
A1 = A(0) % this is wrong..throws error.

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!