How to stop overwriting?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Jan
il 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!