The logical indices contain a true value outside of the array bounds
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi.
I have the problem: "The logical indices contain a true value outside of the array bounds" in this code:
crsPatch{c,ii} = bestPatchMatchTempD(crsPatchMasks{c,ii});
- Where crsPatch is a 6x5 cell array containing 27x1 singles
- bestPatchMatchTempD is a 131x98x84 singles (an mri-image)
- crsPatchMasks is a 6x5 cell array containing 131x98x84 logical
In my main, I am able to run this code about 43000 times out of 47000 - and then the error comes. Anyone familiar with this problem?
In advance, thanks!
1 Kommentar
Walter Roberson
am 6 Nov. 2019
bestPatchMatchTempD is a 131x98x84 singles (an mri-image)
I suspect that at least one of your images is smaller than that.
Antworten (1)
Steven Lord
am 6 Nov. 2019
I recommend setting an error breakpoint and running your code again. When the code throws the error and stops at the breakpoint, check that your variables are the sizes and data types you expect them to be and check that they have reasonable values for your application.
If I had to guess I'd say that c is a logical array with more than 6 elements, and one of the elements past the sixth is true when you didn't expect it to be, so the indexing into crsPatchMasks fails. ii is probably a loop variable, which are usually double precision, and if that took on a value greater than 5 you would have received a different error.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!