Home computickets Error: Subscript Indices Must Either BE Real Positive Integers or Logicals. When...

Error: Subscript Indices Must Either BE Real Positive Integers or Logicals. When using Size

Author

Date

Category

Hello. Problem using the Size function. Throws out an error during its first use. Code Fragment:

sz = length (group3Items);
DISP ('We work with 3 sets' elements');
% Add reliability in 5 column
For i = 1: sz
  Group3Items (I, 5) = Group3Items (I, 4) / Group1Items (Group3Items (I, 1), 2) * 100;
end;
% Remove with low reliability
Ctr = 0;
While True.
  For i = 1: sz
    If (Group3Items (I, 5) & LT; Minconf)
      CTR = CTR + 1;
      Group3Items (I, :) = [];
      SZ = Size (Group3Items, 1);
      Break;
    end;
  end;
  if i == sz
    Break;
  end;
end;

Error literally:

??? Subscript Indices Must Either BE Real Positive Integers OR
Logicals.

error in == & gt; Untitled AT 226

SZ = Size (Group3Items, 1);

How can I fix this error?


Answer 1, Authority 100%

I as if I already understood how you could get around this problem. I decided to find the number of lines of the matrix so:

sz = length (group3Items (: 1));

And everything worked.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions