convert cell array to double error: Dimensions of arrays being concatenated are not consistent.

3 views (last 30 days)
I have a cell array like this:
T_input_mod =
{'456358'}
{'0' }
{'0' }
{'457' }
{'0' }
When I use this:
a = str2num(cell2mat(T_input_mod))
I encounter this error:
Error using cat
Dimensions of arrays being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
What should I do?

Accepted Answer

Simon Chan
Simon Chan on 8 Mar 2022
Use function str2double
  6 Comments
Stephen23
Stephen23 on 8 Mar 2022
"I call it from an Excel with 10000 rows. I cant load it separately. Is there any solution to solve this?"
Probably you should use READTABLE or READMATRIX or READCELL to avoid this situation in the first place.
Please upload your Excel file by clicking the paperclip button.

Sign in to comment.

More Answers (0)

Categories

Find more on Tables 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!