How can I send text-files to a specific folders?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
AJ516
il 26 Lug 2017
Risposto: Walter Roberson
il 26 Lug 2017
What lines of code would be useful to send .txt files to different and specific folders?
Here is my path.
H:\wall_location_dataset\ExtractVolume_01\avg DATA
My intentions is to send the 4 text files to avg DATA instead of ExtractVolume_01.
Here is a section of code of what I have for a set of codes. This part of the program allows the loop to assign a number to a text file (avg+j+.txt, ex. avg1.txt) and record slope and two y-intercepts. What approach should I use to specify the path to a folder (send to avg DATA) and allow the loop (for j=1:4) to assign the numbers to the textfile (avg[1,2,3, OR 4].txt?
fileOutput=sprintf('avg%01d.txt',j);
fileOut= fopen(fileOutput,'wt');
fprintf(fileOut,'Data avg results \r\n');
fprintf(fileOut,'avg%0.0f\r\n',j);
fprintf(fileOut,'Data order (1-2): Slope , Y-int (xy1), Y-int (xy2) \r\n');
fprintf(fileOut,'Slope= %0.4f\r\n',m);
fprintf(fileOut,'Y-int(x1y1)= %0.4f\r\n', Bxy1);
fprintf(fileOut,'Y-int(x2y2)= %0.4f\r\n', Bxy2);
fclose(fileOut);
0 Commenti
Risposta accettata
Walter Roberson
il 26 Lug 2017
outdir = 'avg Data'; %you can fully qualify the directory name
fileOutput = fullfile( outdir, sprintf('avg%01d.txt',j) );
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Import and Analysis 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!