How to get missing functions in Matlab 2018b about table and timetable operations?

Hello dear community!
I have just realized that the functions below listed do not exist in my Matlab 2018b version with all toolboxes installed. Those functions are supposed be introduced in 2018a in the documentation.
  • addvars
  • splitvars
  • mergevars
  • movevars
  • removevars
How can I use those functions? Do you have any ideas? Is my Matlab installed wrongly?

6 Comments

Those should be part of basic MATLAB from R2018a onwards, provided that the first parameter to the function is a table .
Try using
restoredefaultpath
rehashtoolboxcache
If that does not work, please show us the error message from trying to use them.
Thank you Walter. Yes, it worked but I just realized that if there is no defined table variable in the workspace, when I type "addva..." in command window or script then press TAB, the intellisense does not work.
My code is here and it is working with no problem:
load patients
cell_array_of_tables = {table(LastName,Age,Height,Weight),table(Location,Systolic,Diastolic)};
cell_array_of_tables_with_gender = cellfun(@(x) addvars(x,Gender),cell_array_of_tables,'uni',false);
Here is a screenshots of what I am trying to say. First screenshot without a table variable in workspace, second screenshot with a table variable in workspace.
Is it a bug or is it implemented intentionally in this way to prevent wrong usage of those functions?
Comparison.JPG
The prediction code does not search for all method names of all data types: it saves resources by only looking at the methods of variables that are present.
(It might not work exactly that way. If you experiment with "which" then you will see that "which" does not know the name of any method of a datatype that has not been loaded yet this session, not until the class definition has been parsed and loaded into memory once (and not yet removed with "clear all")
OK, now I understand and that makes sense.
There is a still weird situation here. When I call that function without a table input, it gives the below error which does not make sense actually. I should have expected another error rather than "this function does not exist" to understand what I am missing or doing wrong etc...
>> addvars
Undefined function or variable 'addvars'.
This exception made me think that "addvars" does not exist in my Matlab version.
addvars is a method not a general function. It is only defined for a few classes. MATLAB does not search all methods of all classes: at most it only includes methods of classes that have been parsed during the current session (and have not been cleared)

Sign in to comment.

 Accepted Answer

The needed functions are present in r2018a, but were not showing up in the pop-up help because the pop-up help can only pop up for classes that MATLAB has parsed in this session.

More Answers (0)

Categories

Products

Release

R2018b

Community Treasure Hunt

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

Start Hunting!