MATLAB Answers

PRIYANGA

How to Rectify the "index must be a positive integer or logical" Error in my code?

Asked by PRIYANGA
on 14 Dec 2012
Accepted Answer by Matt J

Hi....Everybody... How are you?

??? Attempted to access dompol1(-1,:); index must be a positive integer or logical.

Error in ==> DEIMGC at 12 D1=dompol1(fraco(4),:);

Error in ==> VQWTVARWTQT at 486 [cimg1g]=deimgc(vqcode7g,dompool3g,gsize,scale);

This is Error in my code? How to correct that Error in my code.

>>

  0 Comments

2 Answers

Matt J
Answer by Matt J
on 14 Dec 2012
Edited by Matt J
on 14 Dec 2012
 Accepted answer

Stop using negative numbers to index an array, like -1 in the following

 dompol1(-1,:)

It doesn't correspond to any array location.

  2 Comments

PRIYANGA
on 14 Dec 2012

ok Sir.

But, how to convert the value negative to positive and pass that value through the function?

I have to calculate the vqcode7r,vqcode7g,vqcode7b values.. the result of the R G B any one is contain the negative value. how to stop the negative values occur in the calculation.

PRIYANGA
on 14 Dec 2012

Thank You sir.


Answer by Muruganandham Subramanian on 14 Dec 2012
Edited by Muruganandham Subramanian on 14 Dec 2012

Use abs() command

  1 Comment

PRIYANGA
on 14 Dec 2012

Thank you sir


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today