How to stop overwriting?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I wrote a function, which lists the directory of a given URL. Now I got several URLs which I want run over a loop to list all directories of the URLs in a array.
My problem is that this function overwrites the founded stuff of an URL (iteration i) with the founded directory of the followed URL of (iteration = i+1) and so on, until it just gives the directory of the last URL of the loop instead of all. How can I change it?
The URLs are attached.
folderCellArray = {}
data = readcell('founded_medicine_folder.xls')
saveFileName = 'try.xls'
for i = 1:4
url = data{i,1}
dd= listAllDirectories(url, folderCellArray, saveFileName)
%I guess some concat step is missing here
end
0 commentaires
Réponse acceptée
Jan
le 13 Mar 2021
Maybe:
dd = cell(1, 4);
for i = 1:4
url = data{i, 1};
dd{i} = listAllDirectories(url, folderCellArray, saveFileName)
end
But what happens inside listAllDirectories? The name "saveFileName" might mean, that something is overwritten there. Then either instruct this function to append the data. Or use a new file name in each itereation:
for i = 1:4
url = data{i, 1};
saveFileName = sprintf('try%03d.xls', i);
dd = listAllDirectories(url, folderCellArray, saveFileName)
end
0 commentaires
Plus de réponses (0)
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!