Write Data to .txt or .csv file?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to write data that I have in a matrix to a .txt or .csv file. I have data in a 250x2 matrix, and would simply like to be able to write this out to a file of my choice, say 'data.txt' or something like that. Is there an easy way to do this?
0 Commenti
Risposta accettata
Oleg Komarov
il 4 Ago 2011
4 Commenti
Oleg Komarov
il 4 Ago 2011
compose the destination folder dynamically:
root = 'C:\User\Me\Documents\';
fname = 'filename.txt';
dlmwrite([root fname]...)
Image Analyst
il 4 Ago 2011
Or use fullfile
fullFileName = fullfile(root, fname);
fullfile takes care of creating the correct filename regardless of whether root has a trailing slash or not.
or sprintf
fullFileName = sprintf('%s/%s', root, fname);
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!