Why is tab completion broken for my struct?
10 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Shruti Sapre
2015-7-29
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!