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
0 个评论
采纳的回答
Image Analyst
2020-9-19
See the dec2bin() function.
2 个评论
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!