Custom functionSignatures.json stopped working on upgrade from R2019b to R2021b
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Chris Dean
am 12 Okt. 2022
Kommentiert: Steven Lord
am 18 Nov. 2022
I created a plot generator function in R2019a. It takes in a table and up to 4 column names to group and plot the data. I added a functionSignatures.json file next to it which was really handy to autocomplete the possible column names. When I upgraded to R2021b the autocomplete stopped working. If I re-open R2019b (still installed side-by-side with 2021b) the exact same inputs still work as they used to, but in 2021b it just shows "No suggestions found".
I searched the release notes for references to json between these two versions and didn't see anything stick out. https://www.mathworks.com/help/matlab/release-notes.html?rntext=json&startrelease=R2019b&endrelease=R2021b&groupby=release&sortby=descending&searchHighlight=json
I was able to re-create this behavior with the minimal example below:
functionSignatures.json
{
"MyPlot":
{
"inputs": [
{"name":"tbl", "kind":"required", "type":"table"},
{"name":"xvar", "kind":"positional", "type":["choices=matlab.internal.tabular.functionsignatures.keyChoices(tbl)"]},
{"name":"yvar", "kind":"positional", "type":["choices=matlab.internal.tabular.functionsignatures.keyChoices(tbl)"]},
{"name":"extra1", "kind":"positional", "type":["choices=matlab.internal.tabular.functionsignatures.keyChoices(tbl)"]},
{"name":"extra2", "kind":"positional", "type":["choices=matlab.internal.tabular.functionsignatures.keyChoices(tbl)"]}
],
"outputs": [
{"name":"out"}
]
}
}
MyPlot.m
function MyPlot(tbl, xvar, yvar, extra1, extra2)
plot(tbl.(xvar), tbl.(yvar));
end
Add those two files next to each other in some folder and go to that folder in R2019b.
Create a dummy table
t = table([1:10]', rand(10,1), 'VariableNames', {'Idx','RandNum'})
and try to use MyPlot
MyPlot(t, '
and you will see autocomplete options
Repeat this in 2021b and you will see "No completions found"
Please advise if I need to update something for this to work in 2021b. My plotter function still works, I just wish I got to use the autocomplete I'm used to having.
0 Kommentare
Akzeptierte Antwort
Chris Dean
am 18 Nov. 2022
1 Kommentar
Steven Lord
am 18 Nov. 2022
"MathWorks® reserves the use of packages named internal for utility functions used by internal MATLAB code. Functions that belong to an internal package are intended for MathWorks use only. Using functions or classes that belong to an internal package is discouraged. These functions and classes are not guaranteed to work in a consistent manner from one release to the next. Any of these functions and classes might be removed from the MATLAB software in any subsequent release without notice and without documentation in the product release notes."
If this functionality is useful for you, please submit an enhancement request asking for this functionality to be added as a documented function. To submit the enhancement request to Technical Support directly please use the Contact Support link under the Get Support heading at the end of this page.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!