how to change a txt file name dynamically?

2 ビュー (過去 30 日間)
Luis Eduardo Cofré Lizama
Luis Eduardo Cofré Lizama 2019 年 2 月 28 日
回答済み: KSSV 2019 年 2 月 28 日
Dear All, I am struggling to change the name of the files saved after I re-arrange my data. I have a loop (x3) in which I read
filename = [Directory,'/S1_S3/MS',num2str(m),'/S',num2str(s),'/C',num2str(c),'.txt'];
then once my data is reorganized I want to save it with a loop-changing name and adding _EMG at the end so the result for m=1,s=1, c=1should look like:
'M1S1C1_EMG.txt'
Also, and perhaps before the above, I need to add a row at the top of my data (3951x13 cell) which contains the headers. BTW I have the headers in a string and need to assign 1 to each column to then save as .txt (tab delimited).
Thanks so much in advance

回答 (1 件)

KSSV
KSSV 2019 年 2 月 28 日
for i = 1:10
fname = strcat('M1S1C',num2str(i),'_EMG.txt')
end

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by