show content of a txt file in a static text.
3 次查看(过去 30 天)
显示 更早的评论
I have a file.txt (various lines of strings) and I want that when I push a button "pushbutton1", the content of this file will be show in a static text (text4)
Thanks for your help
0 个评论
采纳的回答
dpb
2013-11-16
Read the file into a character variable and display the variable.
fid = fopen('file.txt', 'r');
c = fread(fid, inf, 'uint8=>char')';
Set the string property in the textbox to c
2 个评论
dpb
2013-11-16
Yeah,...that came from remembering an example in freadf help that I just cut 'n pasted w/o reading other than the size argument.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!