create csv file with user input and current date as name
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone
I want to create a csv file in desired location with name that include user input and current date.
I manage to create a csv file with the user input and the current date but I'm unable to save it in desired location
SN = input('Please enter the Serial Number ', 's');
fileName = sprintf('freq_res_data_%s_%s.csv',SN, datestr(now,'dd_mm_yy_HHMMSS'));
csvwrite(fileName,out);
I tried to run add the full direction (d:\tom\) but it doesnt work
I tried only on d:\ and it still deson't work
SN = input('Please enter the Serial Number ', 's');
fileName = sprintf('d:\tom\freq_res_data_%s_%s.csv',SN, datestr(now,'dd_mm_yy_HHMMSS'));
csvwrite(fileName,out);
tom folder is exist
how can I save in any other directory then the current folder?
0 Commenti
Risposte (2)
Benjamin Thompson
il 11 Mag 2022
Use sprintf to generate a local string variable. Use a \\ sequence to include a single \ in the string. Then pass the string as a filename to csvwrite.
» SN = '2'
SN =
'2'
» fileName = sprintf('d:\\tom\\freq_res_data_%s_%s.csv',SN, datestr(now,'dd_mm_yy_HHMMSS'))
fileName =
'd:\tom\freq_res_data_2_11_05_22_075347.csv'
2 Commenti
Benjamin Thompson
il 11 Mag 2022
Please post the code and any errors you are getting from MATLAB. Remove semicolons after statements so you can see return results.
Vedere anche
Categorie
Scopri di più su Spreadsheets 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!