Effacer les filtres
Effacer les filtres

How can I send text-files to a specific folders?

1 vue (au cours des 30 derniers jours)
AJ516
AJ516 le 26 Juil 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);

Réponse acceptée

Walter Roberson
Walter Roberson le 26 Juil 2017
outdir = 'avg Data'; %you can fully qualify the directory name
fileOutput = fullfile( outdir, sprintf('avg%01d.txt',j) );

Plus de réponses (0)

Catégories

En savoir plus sur Low-Level File I/O dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by