필터 지우기
필터 지우기

xlswrite output numbered files

조회 수: 2 (최근 30일)
Silver
Silver 2018년 9월 6일
댓글: Silver 2018년 9월 6일
I have 20 csv files named differet names, I want to make a program to rename them so they will be numbered this way :
  • M_1_1
  • M_1_2
  • M_1_3
  • And so on ...
When I use this code :
filename_M_1 = strcat('M_1_%g.xlsx'); % g is the number of files in the directory, I put on the top of the program for g=3:length(Folders) to run the list of files in the directory
xlswrite(filename_M_1,D,1,'A1') %D is the matrix
I have a result like this :
Any ideas ? thanks for help

채택된 답변

Geoff Hayes
Geoff Hayes 2018년 9월 6일
Silver - try using sprintf to create your file name
for k = 1:20
filename = sprintf('M_1_%d.xlsx', k);
% create new file
% your code here
end
  댓글 수: 1
Silver
Silver 2018년 9월 6일
It works ! Thank you so much !!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by