Attempt to grow array along ambiguous dimension
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
error in my code is: my code is running for some images but not for some images. temp_x{n1}(ind_count) = x(n2);
my opengl info is: Version: '1.1.0' Vendor: 'Microsoft Corporation' Renderer: 'GDI Generic' MaxTextureSize: 1024 Visual: 'Visual 0x23, (RGB 24 bits (8 8 8), Z depth 16 bits, Software, Single buffer, Antialias 0 samples)' Software: 'true' HardwareSupportLevel: 'none (known graphics driver issues)' SupportsGraphicsSmoothing: 0 SupportsDepthPeelTransparency: 0 SupportsAlignVertexCenters: 0 Extensions: {3×1 cell} MaxFrameBufferSize: 0
0 commentaires
Réponses (1)
Walter Roberson
le 15 Fév 2018
Your opengl turns out to not be relevant to this.
You have a 2d or 3d array. You are assigning into the array using a single subscript, so that means you are using linear indices. Some of the target indices being assigned to are larger than the number of elements in the array, so MATLAB needs to grow the array. But which dimension should it grow the array on? Add more rows? Add more columns? Add more to the third dimension? Start into the next dimension beyond the existing ones? MATLAB does not have a rule for which dimension to expand when you attempt to assign to a linear index beyond the end of an array that is not a vector (vector is well defined for this) so it gives you the ambiguous dimension error.
If you are deliberately expanding the matrix then translate the linear indices into row and column references so that MATLAB can see which dimension is being grown.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!