MATLAB: Show content of a txt file in a static text.
show txt static text
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
Best Answer
Read the file into a character variable and display the variable.
Usefopen to open the file and then usefscanf orfgetl to read in the content. You can also usefread. For example, the following code reads the first line of the text.
fid = fopen(v,'r');
tline = fgetl(fid);
fclose(fid)
Just to remember close the file usingfclose afterwards.
Best Answer