creating a .txt file with values that the user inputs in Matlab app designer

12 visualizaciones (últimos 30 días)
hello,
i am wondering how can i create a brand new .txt file in matlab. I would like create a text file that is unique to input from the user. For example if the user inputs this "4" i would like the text file to be created with this name "4.txt". If the user inputs "helloworld" the new text file would be "helloworld.txt". How am i able to do this?
i am using matlab verison R2019b
thank you

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 11 de Jun. de 2021
Joseph - if your app has a text field that allows the user to enter the name of the file to save to, then you could do something like
filename = [app.FileName.Value '.txt'];
then use whatever function (for example fprintf) to write data to this file. Alternatively, you could use uiputfile to show a dialog where the user can choose the location and filename for the data to be saved.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings 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