I am not new to Matlab, but I have a very strange error I have not encountered before under the circumstances. I have tried to make a simplified version of my code to demonstrate the error I am getting. Basically, I have the indexing error, but the index being accessed is a positive integer.
I am wondering if it may have something to do with the format of the index number. Anyway, any help or suggestions would be greatly appreciated.
t=(0:0.00001:2*pi);
Cir(1,1:length(t)) = 0;
Cir(2,1:length(t)) = 0;
Cir(3,1:length(t)) = 0;
D0(1:length(t)) = 0;
% Search for the first minimum
[min1D0,t1Found] = min(abs(D0(1:length(t)/2)));
% Search for the second minimum
[min2D0,t2Found] = min(abs(D0(length(t)/2:length(t))));
t2Found = t2Found + length(t)./2; % Add tIndex/2 to correct the index
C1 = [Cir(1,t1Found),Cir(2,t1Found),Cir(3,t1Found)];
C2 = [Cir(1,t2Found),Cir(2,t2Found),Cir(3,t2Found)];
The output is:
Warning: Integer operands are required for colon operator when used as index
Warning: Integer operands are required for colon operator when used as index
??? Attempted to access Cir(1,314161); index must be a positive integer or logical.
Note: I am using R2009b.