How to read and use folder name from Address Path?

1 ビュー (過去 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."
  1 件のコメント
Santosh Biradar
Santosh Biradar 2022 年 9 月 4 日
Thank you so much @Stephen23.
It worked.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Find more on Startup and Shutdown in Help Center and File Exchange

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by