필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Stefan
Stefan 2018년 1월 30일
편집: Stefan 2018년 1월 30일
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

답변 (1개)

KSSV
KSSV 2018년 1월 30일
prompt = 'Give name of file:' ;
str = input(prompt,'s') ;
Now use str
  댓글 수: 1
Stefan
Stefan 2018년 1월 30일
편집: Stefan 2018년 1월 30일
Thanks for your answer. My code still doesn't work:
a ='T:\...\default.pdf';
newName = str;
movefile( a, newName );

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by