How to read and use folder name from Address Path?

조회 수: 4 (최근 30일)
Santosh Biradar
Santosh Biradar 2022년 9월 4일
댓글: Santosh Biradar 2022년 9월 4일
Hello
This SelMatPathOld is having path location 'D:\ninn\2_resimResult_0628\20220330'
I will first read only last part of above address path, i.e., 20220330.
In current dictionary, there is one folder "ComapareSummary"
So I need to change "ComapareSummary" as "20220330_SysLimDiff"
So, whatever comes in SelMatPathOld, the last folder name will be replaced "ComapareSummary" as "********_SysLimDiff"
I read movefile. But I can not understand how to change it dynamically.
Please let me know for brief.
Thank You

채택된 답변

Stephen23
Stephen23 2022년 9월 4일
편집: Stephen23 2022년 9월 4일
SelMatPathOld = 'D:\ninn\2_resimResult_0628\20220330';
[~,sub] = fileparts(SelMatPathOld)
old = fullfile('.',"ComapareSummary")
new = fullfile('.',sub+"_SysLimDiff")
movefile(old,new)
"But I can not understand how to change it dynamically."

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by