필터 지우기
필터 지우기

ascii data type

조회 수: 3 (최근 30일)
Rene
Rene 2011년 6월 3일
i am making a program that needs to import data from a elcomat 2000 into a matlab workspace. teh data type i get is an ascii type. how would i convert an ascii type to a decimal? i am using the fread command to read data from the instrument.

답변 (2개)

Rob Graessle
Rob Graessle 2011년 6월 3일
Since ASCII characters are encoded as unsigned 8-bit integers, you can store them as a UINT8 data type in MATLAB. You can use the UINT8 function to get the ASCII values of a character string.
>> a='ABCabc!@#$%^&*()-+'
a =
ABCabc!@#$%^&*()-+
>> uint8(a)
ans =
65 66 67 97 98 99 33 64 35 36 37 94 38 42 40 41 45 43
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 6월 3일
Only if it is US-ASCII ;-)
There were a number of different ASCII. For example, in the UK version of ASCII, the position held by '$' is the pound sign.

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


Walter Roberson
Walter Roberson 2011년 6월 3일
Possibly the answer you are looking for is str2double()

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by