Borrar filtros
Borrar filtros

read data from a text box and save as .m file

3 visualizaciones (últimos 30 días)
Bonny Okam
Bonny Okam el 26 de Jun. de 2012
i have designed a GUI with a textbox and i want to read the data (particularly text data) a user paste unto the textbox and store it as a .m file when ever a push button is clicked. I already have a function that requires the use of the text that will be saved as a .m file. can anyone help with suggestion or code that can do this? Thanks in advance.

Respuesta aceptada

Alexandru
Alexandru el 26 de Jun. de 2012
Hi, you can try this in the callback of the button you use to save the text to the .m file.
textbox_data = get(handles.textbox_tag,'String');
fid = fopen('File.m', 'w');
fprintf(fid, '%s\n', datestr(now));
fprintf(fid, '''Comment:'' %s\n', textbox_data);
fclose(fid);
  1 comentario
Bonny Okam
Bonny Okam el 26 de Jun. de 2012
Tanx Alex, it worked well and gave me the expected output, just the way i want it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by