필터 지우기
필터 지우기

Convert text of multiple digits to numbers

조회 수: 1 (최근 30일)
saeed
saeed 2014년 7월 31일
편집: saeed 2014년 8월 5일
if i have a variable x containing in each row something like this :
  • 123123123
  • 123798731
  • 234874343
if i use class(x) it prints char . and if i write cellstr(x) i get :
  • ' 123123123 '
  • ' 123798731 '
  • ' 234874343 '
how can i convert x to column of numbers so :
1- each row is a number meaning x(1) = 123123123 and not 1.
2- i would be able to use meshgrid(x,x) and i would get the output :
123123123 123798731 234874343
123123123 123798731 234874343
123123123 123798731 234874343
thanks

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 31일
A={' 123123123 '
' 123798731 '
' 234874343 '}
str2double(A)
  댓글 수: 4
saeed
saeed 2014년 7월 31일
편집: saeed 2014년 7월 31일
same output for both ways , see pictures below.
saeed
saeed 2014년 8월 5일
편집: saeed 2014년 8월 5일
well... the problem was that my numbers were long like 24-25 digits and matlab couldnt print it that long (although i used format long), but in general your method works , thank you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by