Poissrnd throwing Warning: Colon operands must be real scalars...

조회 수: 30 (최근 30일)
MikeStein
MikeStein 2011년 9월 11일
답변: Kazem 2024년 7월 10일
Hello all, I am using poissrnd on a 49x49 array of some detector photocounts (on the order of 10^6), and I keep getting the following warnings each time I run the command. I've picked and chosen a few random numbers from the matrix, and I can't seem to replicate the warning. I'm trying to figure out why it's being thrown and what I can do to stop it.
K>> poissrnd(round(I1));
Warning: Colon operands must be real scalars.
> In binornd at 62
In poissrnd at 66
In poissrnd at 61
In poissrnd at 61
In poissrnd at 61
In poissrnd at 61
In poissrnd at 61
In poissrnd at 61
In poissrnd at 61
In spatialSRI4 at 105
Warning: Colon operands must be real scalars.
> In binornd at 62
In poissrnd at 66
In poissrnd at 61
In poissrnd at 61
In spatialSRI4 at 105
Warning: Colon operands must be real scalars.
> In binornd at 62
In poissrnd at 66
In poissrnd at 61
In spatialSRI4 at 105
Warning: Colon operands must be real scalars.
> In binornd at 62
In poissrnd at 66
In spatialSRI4 at 105
Note that this happens even if I do round(abs(I1)) as the input to poissrnd.
Thanks all, -Mike

답변 (4개)

Walter Roberson
Walter Roberson 2011년 9월 11일
I suggest you invoke
dbstop if warning
and then when the warning pops up, you would be able to examine the statement binornd at 62 and see what values it has and what the problem is with those values.
  댓글 수: 1
MikeStein
MikeStein 2011년 9월 11일
Well I haven't done that, but this may tell you what you're looking for:
I did a little debugging, and it seems like poissrnd has some sort of a recursive process over the array that I pass in. While the numbers I pass in are all real scalars, as this recursive process whittles down the input array, it somehow winds up turning them into decimal numbers that it recursively then operates over...

댓글을 달려면 로그인하십시오.


MikeStein
MikeStein 2011년 9월 14일
anyone?

Michael
Michael 2012년 11월 6일
I just experienced this problem when I used an array of type single, but it stopped when I changed it to double. So that's a workaround.
Still, this seems like a big ol' bug that Mathworks should really get fixed after more than a year. Submit support requests to get their butts in gear.

Kazem
Kazem 2024년 7월 10일
I had similar warning and the problem was from
the index of array had length more than one.
It means that
val = A (x)
x was [6, 9]

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by