Why is tab completion broken for my struct?

10 visualizaciones (últimos 30 días)
Matthias
Matthias el 27 de Jul. de 2015
Respondida: Shruti Sapre el 29 de Jul. de 2015
Hi,
I wrote a class with a struct as one of the properties. For that particular struct, tab completion does not work, i.e. when I press tab after writing "obj.struct." it says "No Completions Found.". Completion works for other structs in other properties of the same object.
Now, I guess that this is due to some issue in my code, which prevents the tab completion algorithm from assembling a list of field names. Does anyone know what code issues might cause such a problem with tab completion (in general)? The code does not produce any errors, and typing "obj.struct" displays a list of fieldnames and values as usual. Just tab completion does not work.
I can't provide simple code to replicate the problem since the code that generates the problematic struct is quite complex. I'm just wondering if someone has a general idea of which issues cause failures in tab completion of struct fields.
Thanks, Matthias

Respuestas (1)

Shruti Sapre
Shruti Sapre el 29 de Jul. de 2015
Hi Matthias,
Here are a few general reasons that might cause tab completion to not work on a structure in a class:
1. The structure could be a private member of the class. This will not allow it to show up on hitting the tab key.
2. The "TC.xml" file might have been corrupted. This could be caused by installing third-party toolboxes (those not made by Mathworks) into MATLAB. Restoring the “TC.xml” could help fix the problem. You can contact Mathworks Technical Support for resolving this issue.
3. Because tab completion uses static analysis, it doesn’t try to guess the data type for a variable, so properties and fields won’t be completed unless that variable is also defined in the workspace. For similar reasons, variables created through eval, assignin, load, etc. won’t be added to the list of completions.
4. In the Editor, MATLAB does not complete field names of structure arrays defined only within the active file.
5. In case the structure is complex and cannot be analyzed for some reason, it might help to check the structure outside the class and see if tab completion works
Hope this helps!
-Shruti

Categorías

Más información sobre Structures en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by