Read text file and display binary

3 次查看(过去 30 天)
Hi all..I want to read a text file in matlab chracter by character and display it in 16-digit binary. Please help, I am not a matlab expert

采纳的回答

Image Analyst
Image Analyst 2020-9-19
See the dec2bin() function.
  2 个评论
amal nuri
amal nuri 2020-9-20
Thanks..Can you give me an example
Image Analyst
Image Analyst 2020-9-20
You know you can look up any function anyone mentions here in the help, right? And the help almost always has examples. Anyway, here is mine:
number = 1234567
string = dec2bin(number)
number =
1234567
string =
'100101101011010000111'
There is also a function called fileread() that you can look up in the help to read the whole textfile into one string. Or you can use fgetl() to read in a line at a time.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by