title: find maximum no. in matlab
body: <p>I have 1901 g values. I am accumulating it in t as</p>
  
  <pre><code>xr=[qq] ; %Training and Anomaly Samples in sequence
  z=numel(xr);
  N=100;
  t=zeros(1,z-N+1);
  for n5=0:z-N;
  x=xr(1+n5:N+n5);
  d=max(x);
  m1=numel(x);
  y=zeros(d,1);
  p=zeros(d,d);
      for k=1:m1-1
       y(x(k))=y(x(k))+1;
       p(x(k),x(k+1))=p(x(k),x(k+1))+1;
      end
      p=bsxfun(@rdivide,p,y);
      p(isnan(p))=0;
      b2=sum(log(p(p~=0)));
      [~,~,idx] = unique(x);
      q=prod(hist(idx,1:max(idx))/numel(x));
      l=log(q);
      g1=b2+l;
    t(n5+1)=g1; %log value    
  end
  </code></pre>
  
  <p>in above qq generated by other code and has a integers in between 1 to 100, qq length is 2000. here t has length in 1901. when I am doing <code>max(t)</code>  then it showing answer.   so how to find  maximum value among first 400 iterations. when I am doing max(t(1:400)) it showing error   </p>
  
  <pre><code>Subscript indices must either be real positive integers or logicals.  so how his error occurs.
  </code></pre>