Error using sub2ind: out of range subscript

3 visualizzazioni (ultimi 30 giorni)
BIANCA
BIANCA il 9 Gen 2025
Risposto: Satwik il 16 Gen 2025
Hi,
I am running a matlab gui and when I load the data (multitiff file) and display it in the axes I get the following error. I don't know how to proceed because the error doesn't appear every time I run the code. I tried to check which version of sub2ind maltab is using and it seems to use the correct version. Thank you in advance for your help.
Warning: Error occurred while executing the listener callback for event Action defined for class
matlab.graphics.interaction.graphicscontrol.AxesControl:
Error using sub2ind
Out of range subscript.
Error in matlab.graphics.chart.interaction.dataannotatable.ImageAdaptor/getNearestImageIndex (line 369)
index = sub2ind(dataSize, nRC(1), nRC(2));
Error in matlab.graphics.chart.interaction.dataannotatable.ImageAdaptor/doGetNearestPoint (line 225)
index = getNearestImageIndex(hObj, point_v, basis_row, basis_col);
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.graphicscontrol.InteractionObjects.DataTipHoverLingerInteraction/handleEvent
Error in matlab.graphics.interaction.graphicscontrol.InteractionObjects.DataTipBaseInteraction/response
Error in matlab.graphics.interaction.graphicscontrol.InteractionObjects.InteractionBase/responseevent
Error in matlab.graphics.interaction.graphicscontrol.InteractionObjects.InteractionBase
Error in matlab.graphics.interaction.graphicscontrol.GenericControl/process
Error in matlab.graphics.interaction.graphicscontrol.layoutable.LayoutableControl/process
Error in matlab.graphics.interaction.graphicscontrol.layoutable.GridLayoutableControl/process
Error in matlab.graphics.interaction.graphicscontrol.AxesControl/process
Error in matlab.graphics.interaction.graphicscontrol.ControlManager/processMessage
> In matlab.graphics.interaction.graphicscontrol/GenericControl/process
In matlab.graphics.interaction.graphicscontrol.layoutable/LayoutableControl/process
In matlab.graphics.interaction.graphicscontrol.layoutable/GridLayoutableControl/process
In matlab.graphics.interaction.graphicscontrol/AxesControl/process
In matlab.graphics.interaction.graphicscontrol/ControlManager/processMessage
  2 Commenti
dpb
dpb il 9 Gen 2025
I think you'll have to submit this to official support with the app that causes the error...
You could try setting a breakpoint on error in the callback and see what the indices are at the tme it does fail, but it likely won't be anything you can fix given it's in the base code.
BIANCA
BIANCA il 9 Gen 2025
Ok, thank you. I will try to submit it to official support.

Accedi per commentare.

Risposte (1)

Satwik
Satwik il 16 Gen 2025
I faced a similar warning message and error while working on a project. This behaviour occured sporadically. It turned out to be a graphics issue. Running the following command in the MATLAB command window before running the project fixed the issue for me:
>> opengl software
The above approach could help resolve the issue in your case as well. For more information on 'opengl', please refer to the following documentation:
I hope this helps!

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Tag

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by