Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
AJ516
AJ516 am 26 Jul. 2017
Beantwortet: Walter Roberson am 26 Jul. 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);

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by