필터 지우기
필터 지우기

Error using table/vertcat

조회 수: 6 (최근 30일)
Christoph Funke
Christoph Funke 2020년 10월 15일
댓글: Christoph Funke 2020년 10월 30일
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
Mathieu NOE
Mathieu NOE 2020년 10월 15일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 30일
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.
  댓글 수: 1
Christoph Funke
Christoph Funke 2020년 10월 30일
Thanks! I reinstalled MATLAB and it works fine again.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Manvi Goel
Manvi Goel 2020년 10월 30일
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:

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by