I am having trouble finding the source of an indexing error
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am dealing with some large arrays and I keep getting the error: “Indices must be real positive integers or logical” or “Index exceeds size.” The vector of indices is created through the function ALLCOMB. The inputs to ALLCOMB are vectors of positive integers, so the output should be a matrix of positive integers. I have been able to find the location of the offending index on several occasions and it turns out to be a 6+eps or a 9+eps rather than a 6 or a 9. The truly puzzling part though, is that I cannot change these values in my vector. While in debugging mode, I have tried to round the vector, change the data type to int8 or uint8, and I have even manually typed in the correct integer values, but to no avail. I will type in A(1,7819)=9, then check the value before moving on, and it is still 9+eps.
Also, when I get the error “Index exceeds size,” I will view the max and min of my vector of indices to find that they are in fact well within the size of the referenced array.
I am also getting “out of memory” errors on programs that have successfully run only minutes before. I increased the Java Heap size, but with no effect.
I am starting to suspect an issue with my system, any suggestions? I’ll list my system specs below:
Machine: iMac 21.5-inch Mid 2011 Processor: 2.8 GHz Intel Core i7 Operating system: OS X 10.8.3 Memory: 32 GB DDR3 Storage: 251 GB Flash with 172GB free and a 2TB SATA (MATLAB installed on Flash)
0 Commenti
Risposte (1)
Image Analyst
il 28 Mag 2013
Well we can't do much without seeing any code. But I'd say that if you cast the indexes, "A", to integers and it's still saying that, then you must have 0 or negative numbers, or a positive number greater than numel of whatever array you're trying to use "A" as indices for, or greater in one of the dimensions. Of course if you really cast to int32, then no number is going to be an integer plus eps. 32 gigabytes of RAM is impressive and should handle most MATLAB programs. Tell me this:
size(theArray) % The size of the array A will be used as indices for.
minA = min(A(:)) % No semicolon so it will print to the command window.
maxA = max(A(:)) % No semicolon so it will print to the command window.
5 Commenti
Image Analyst
il 28 Mag 2013
My gosh - why is A so huge? Why do you need indexes that go as high as 170 million? I've never had an index go that high.
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!