creating multiple excel files
Afficher commentaires plus anciens
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
Réponses (1)
Azzi Abdelmalek
le 6 Mar 2013
Modifié(e) : Azzi Abdelmalek
le 6 Mar 2013
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 commentaire
Sugar Mummy
le 22 Jan 2022
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!
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!