Why can't i change an excel file sheets during a loop in matlab
Afficher commentaires plus anciens
Hi,
I want this function which is an exemple store the first second and thrid value of ne in an excel sheet each but i also want to it to rename the excel sheets while writing but what i don't understand is when it's done only the first sheet will be renamed and it won't be renamed A but C
function excel(init)
Varlist = ['A' 'B' 'C']
ne = [1 2 3]
a = 1
path_save_csv=uigetdir;
cd(path_save_csv);
while a <= 3
xlswrite('data.xlsx',ne(a),a,'A1');
e = actxserver('Excel.Application');
ewb = e.Workbooks.Open('C:\Users\223080038\Desktop\data.xlsx');
ewb.Worksheets.Item(1).Name =[Varlist(1,a)] ;
ewb.Save ;
ewb.Close(false);
e.Quit ;
a=a+1
end
Réponse acceptée
Plus de réponses (0)
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!