ascii data type
4 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (2 件)
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
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.
参考
カテゴリ
Help Center および File Exchange で Low-Level File I/O についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!