Cell array and double array
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Atsushi Ueno
on 5 Jun 2021
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.
See Also
Categories
Find more on Data Import from MATLAB 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!