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

1 回表示 (過去 30 日間)
AJ516
AJ516 2017 年 7 月 26 日
回答済み: Walter Roberson 2017 年 7 月 26 日
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);

採用された回答

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by