How to change the filename in xlswrite using loop
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Prakhar Modi
le 19 Déc 2019
Commenté : Shivam Mishra
le 30 Mar 2022
Hello everyone,
now I am writing the one .xlsx file with 19 sheets. For which my code is working properly. This is what I am written till now
for a=1:length(sheets)
xlswrite('rough.xlsx',final{a},sheet{a},xlrange1);
end
Now what actually I want is that I need to write my answers in for different xlsx sheets. Means for every one input sheet I will get one xlsx file with 19 sheets. So, how can I change the filename with a different for loop so that for every different input sheet i will get different xlsx file with 19 sheets each.
means as I am able to change the sheets number but how to change the filename.
Thanks in advance
0 commentaires
Réponse acceptée
KALYAN ACHARJYA
le 19 Déc 2019
Modifié(e) : KALYAN ACHARJYA
le 19 Déc 2019
for i=1:
xlswrite([strcat('Any_Initial_name',num2str(j)),'.xlsx'],file_to_write,'Sheet');
end
2 commentaires
Plus de réponses (1)
Ankit
le 19 Déc 2019
using xlswrite in a loop will effect performance. Try this FEX: https://de.mathworks.com/matlabcentral/fileexchange/10465-xlswrite1.
You can try the below changes
for a=1:length(sheets)
fileName = ['rough_', int2str(a), '.xlsx'];
xlswrite(fileName,ARRAY,SHEET,RANGE);
end
3 commentaires
Ankit
le 20 Déc 2019
I tried with random values it is working for me. If I am not wrong length(sheets) = 3?
Just change length(sheets) =3 and let me know your results.
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!