creating multiple excel files
이전 댓글 표시
Hello,
I want to write Matlab data to an excel file. The data I'm working on is monthly data from 99 stocks from the year 2003. So I have 12x99 files that need to be converted.
The problem is that my script only creates 1 excel file and keeps overwriting it. Does anyone know how I can avoid this?
Your help is very much appreciated!
Kind regards, Elien
답변 (1개)
Azzi Abdelmalek
2013년 3월 6일
편집: Azzi Abdelmalek
2013년 3월 6일
Example
data={rand(4),rand(6),rand(8)}
n=3, % number of files
for k=1:n
xlswrite(sprintf('file%d.xls',k),data{k})
end
댓글 수: 1
Sugar Mummy
2022년 1월 22일
I am facing problem in renaming my Excel file. I have a defined variable with values (5x1 double)
values=[0.0082;0.0083;0.0086;0.0087;0.0082];
There is a matfile (test.mat) which have values of variables (a,b and c)
All_values=values;
for i =1:numel(All_values)
values=All_values(i)
T = table(a{1,i}.time, oo{1,i}.signals.values, pp{1,i}.signals.values) %values from .mat file
writetable(T{i},'Check_%i.xlsx',values) %somewhere here is the issue
end
What I want is to rename my file like 0.0082.xlsx, then comes 0.0083.xlsx, 0.0086.xlsx, 0.0087.xlsx and 0.0082.xlsx. The code is running fine till the values of T (making a table). Any help to rename the file would be highly appreciated. Thanks!
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!