How to include current array from multiple for loops into csvwrite filename
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have the following for loop within a for loop:
for lat = [1.5,2,3.5]
for lon = [1,2.5,3]
for year[1990:2019]
(stuff happens)
end
csvdata=[var1,var2,var3]
csvwrite(lat lon.csv, csvdata)
end
end
each output of the lon loop needs to be stored in a seperate file, I would like the CSV file name to be the lat and lon of the current loop so that the csv does not keep overwriting. I do not want to append.
I do not know if it is worth noting that the lat and lon numbers contain decimals.
I have struggled with various things but cannot seem to get it to work. I am new to matlab so appreciate this may be a messy way of doing what I want to do.
Thanks in advance for any help!
0 Commenti
Risposta accettata
Wan Ji
il 25 Ago 2021
Hi, try this command instead
csvwrite([num2str(lat),'_',num2str(lon),'.csv'], csvdata)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Text Files 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!