cell2mat returns an error

조회 수: 12 (최근 30일)
Marc Jakobi
Marc Jakobi 2013년 10월 18일
답변: Andrei Bobrov 2013년 10월 18일
Hi.
I have a large 11000x1 cell array with string values that seems to look something like this in the variables window:
A = {'600'; '400'; '200'; '800'; '600'; '700'}
When I use
cell2mat(A)
I get an error message that says:
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 84)
m{n} = cat(1,c{:,n});
I know the cell array can't be the same as Array 'A' of this example, because I tried it with Array 'A' in the workspace and it worked. I can't find any difference in the variables windows, though.
Here are the propertys
>> whos curr_ch1
Name Size Bytes Class Attributes
curr_ch1 113283x1 13474862 cell
Any idea what could be the problem?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 18일
A= {'600'; '400'; '200'; '800'; '600'; '700'}
cellfun(@str2double,A)
  댓글 수: 1
Marc Jakobi
Marc Jakobi 2013년 10월 18일
Thanks. That did it!

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 10월 18일
Just:
str2double(A)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by