Error using table/vertcat
8 views (last 30 days)
Show older comments
Christoph Funke
on 15 Oct 2020
Commented: Christoph Funke
on 30 Oct 2020
Hi all,
I have been getting an error in the function 'vertcat'. It can be reproduced on my machine by the simple code:
a = array2table(['1', '1']);
b = array2table(['2', '2']);
[a;b]
The code above yields the error message:
Error using table/vertcat
Error: File: vertcat.m Line: 158 Column: 1
Illegal use of reserved keyword "catch".
Error in test (line 3)
[a;b]
Any idea what may be causing this and how to fix it? It appears to be a local error - if I run the same code on a different machine with the same version of MATLAB (2018b), it works fine. I initially thought that I accidently changed something in the vertcat function, but that appears not to be possible since I can't access the source code.
1 Comment
Mathieu NOE
on 15 Oct 2020
hi
you should better describe what is the intention, data inputs and expected outputs
seems just you are not using this function for what it is intended for ... at least in the example
Accepted Answer
Walter Roberson
on 30 Oct 2020
Error: File: vertcat.m Line: 158 Column: 1
In R2018b, toolbox/matlab/datatypes/@tabular/vertcat.m does indeed have a catch at column 1 of line 158 . However, it is a valid catch
So, somehow, somewhere between line 17 of the file and line 158, your file has acquired an extra end statement.
You should probably reinstall MATLAB.
More Answers (1)
Manvi Goel
on 30 Oct 2020
I tried reproducing it at my end and just like you mentioned, it works as expected and the arrays concatenate vertically. It might be a temporary issue that you're facing. Try restarting MATLAB and your local system.
In case this doesn’t work you can restore the default MATLAB search path with the following steps:
1. Take a backup of your 'pathdef.m' file, which can be located by using the command
>> which -all pathdef
Before proceeding, ensure that you make a safe copy of the file by copying it to a folder outside of your MATLAB path.
2. After taking the backup, execute the following commands in the MATLAB Command Window to restore the default MATLAB search path and rehash the toolbox cache:
>> restoredefaultpath
>> rehash toolboxcache
>> sl_refresh_customizations
After this step, please use MATLAB/ Simulink to see if the issue occurs again. If the issue is resolved, then you may want to save the new MATLAB search path by executing the following command:
>> savepath
NOTE: This will remove any custom paths you may have created. The following MATLAB Answers post is an additional resource on how to back them up:
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!