필터 지우기
필터 지우기

copyfile function target folder name problem

조회 수: 2 (최근 30일)
Yu Li
Yu Li 2019년 1월 11일
댓글: Yu Li 2019년 1월 11일
I want copy a file to a targer folder but met a problem.
if the targer folder name is consecutive ('no space'), it works fine, but when a space is added to the folder name, it will report error, below is the test code:
test=rand(5,5);
save test test
newFolder='abc de';
mkdir(newFolder)
eval(['copyfile test.mat ',newFolder])
is there anyway to solve this problem
Thanks!
Yu

채택된 답변

Walter Roberson
Walter Roberson 2019년 1월 11일
As a general rule , any time you use eval() you should assume that you will have bugs and that you should find aa different way to do what you want .
copyfile('test.mat', newfolder)
You should also consider saving there directly
save('abc de/test.mat', 'test')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Testing Frameworks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by