Cell array and double array
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I have imported 40 Excel files into Matlab and I want to concatenate them vertically. I received this error message:
Error using tabular/cat (line 16)
Cannot concatenate the table variable 'MeanICNiActivation' because it is a cell in one table and a
non-cell in another.
16 t = vertcat(varargin{:});
I checked the files, and indeed as the error mentioned some files had columns with cell arrays while a majority of the files contain only double arrays. I have attached images (from Matlab) of parts of the data illustrating this matter i.e. one file with the cell array and another file with double array. I have highlighted the corresponding columns. In the Excel files, the rows with '' in the image (Matlab file) are blank.
My questions are:
- What could possibly cause this to occur i.e. some are classified as double while others as cell? Each file was processed the same way using the same script (I didn't write the script, it was given to me by my supervisor).
- What can I do to get around this issue so I can concatenate my files?
Many thanks.
댓글 수: 0
답변 (1개)
Atsushi Ueno
2021년 6월 5일
I think your script file which is from your supervisor contains 'xlsread' function that is not recommended anymore.
>What could possibly cause this to occur i.e. some are classified as double while others as cell? Each file was processed the same way using the same script (I didn't write the script, it was given to me by my supervisor).
Your script must contain two different use of xlsread functions. (See above)
>What can I do to get around this issue so I can concatenate my files?
You should check out the function 'xlsread' and 'readmatrix' for updating your Excel import functions.
Please excuse me if my guess is wrong.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!