How to rename a file with a string from user input?

2 visualizaciones (últimos 30 días)
Stefan
Stefan el 30 de En. de 2018
Editada: Stefan el 30 de En. de 2018
Hi,
I would like to use a string from a text in prompt and then use movefile to rename a pdf file. Unfortunately, I can't figure out how to use the string for the file name. I would really appreciate your help.
Thanks, Stefan

Respuestas (1)

KSSV
KSSV el 30 de En. de 2018
prompt = 'Give name of file:' ;
str = input(prompt,'s') ;
Now use str
  1 comentario
Stefan
Stefan el 30 de En. de 2018
Editada: Stefan el 30 de En. de 2018
Thanks for your answer. My code still doesn't work:
a ='T:\...\default.pdf';
newName = str;
movefile( a, newName );

Iniciar sesión para comentar.

Categorías

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