Hi everyone.
I am getting the following error when I try to convert the cell array to a double.
C =
'104'
'98'
'98'
'98'
'94'
'94'
'100'
'100'
loadrange = str2num(cell2mat(C))
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
I believe the error is due to the number of elements not being the same size. Is there a way around this?
Thanks!

 채택된 답변

Mohammad Abouali
Mohammad Abouali 2015년 11월 16일
편집: Mohammad Abouali 2015년 11월 16일

1 개 추천

Use str2double() instead.
C={'104',
'98',
'98',
'98',
'94',
'94',
'100',
'100'};
loadrange = str2double(C)
loadrange =
104
98
98
98
94
94
100
100

댓글 수: 2

Aldrich To
Aldrich To 2015년 11월 19일
Thanks Mohammad!
Mohammad Abouali
Mohammad Abouali 2015년 11월 19일
You are welcome.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

질문:

2015년 11월 16일

댓글:

2015년 11월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by