Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
Stefan
Stefan il 30 Gen 2018
Modificato: Stefan il 30 Gen 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

Risposte (1)

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

Accedi per commentare.

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by