Borrar filtros
Borrar filtros

show content of a txt file in a static text.

2 visualizaciones (últimos 30 días)
jose bernardo
jose bernardo el 16 de Nov. de 2013
Comentada: dpb el 16 de Nov. de 2013
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

Respuesta aceptada

dpb
dpb el 16 de Nov. de 2013
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 comentarios
Walter Roberson
Walter Roberson el 16 de Nov. de 2013
'*char' might be better than 'uint8=>char'
dpb
dpb el 16 de Nov. de 2013
Yeah,...that came from remembering an example in freadf help that I just cut 'n pasted w/o reading other than the size argument.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by