Specify type of variable to allow tab completion
Mostrar comentarios más antiguos
Is there a way to indicate the type of a variable to the static analysis tool in Matlab to allow tab completion when coding?
This could be usefull when passing objects as an argument to a function.
2 comentarios
Walter Roberson
el 5 de Ag. de 2019
Would this be for the purpose of text to display in a pop-up hint? Or is the idea that the tab completion would examine all of the variables that are in scope and only list for completion those that have particular data types?
Adam Cooman
el 5 de Ag. de 2019
Respuesta aceptada
Más respuestas (1)
Chidvi Modala
el 8 de Ag. de 2019
0 votos
You can refer to Custom Code Suggestions and Completions
4 comentarios
Walter Roberson
el 8 de Ag. de 2019
This only works while constructing the call to a function, to give hints as to what the proper arguments are for that function. This does not work while creating code for the function itself -- it does not give hints as to what valid class methods or class property names are while typing in the code that implements the class.
Guillaume
el 8 de Ag. de 2019
For that, the easiest is to construct a dummy object at the command prompt with the same name as the variable in the function.
So, at the command prompt create:
input = MyClass; %+ whatever arguments the constructor expects.
Then, you'll get tab completion when writing the function code (even though input shouldn't be in scope).
Bad variable name by the way, input is a matlab function. Plus it doesn't tell you anything about what's in the variable (other than it's the input to the function which the reader already knows).
Adam Cooman
el 8 de Ag. de 2019
Ken Atwell
el 28 de Oct. de 2019
@Adam: Exactly what you describe was added in R2019b -- see function argument validataion. Tab completion will use this information to try to make more targetted suggestions and completion.
Categorías
Más información sobre Java Client Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!