Advanced matlab function autocompletion based on previous input
Hello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear allHello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear all Hello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear all input validation, code suggestion, autocompletion, previous input, function input, multiple, option based MATLAB Answers — New Questions