필터 지우기
필터 지우기

Conversion from char to matrix

조회 수: 15 (최근 30일)
Eric
Eric 2016년 12월 3일
답변: Walter Roberson 2016년 12월 3일
Hi everyone,
I've a char array that looks like this:
numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46]
Is there a way that I can change it to a matrix so that I can use the numbers in the char array?
Thanks a lot in advance.
Best,
Eric
  댓글 수: 1
Stephen23
Stephen23 2016년 12월 3일
The array you show is numeric, not char:
>> numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46];
>> class(numb)
ans = double

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 12월 3일
numb = '[2:4 6:2:12 17 25 26:28 35 37 38:41 46]';
nn = str2num(numb);

카테고리

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