Save a file inside a subfolder of a folder

22 ビュー (過去 30 日間)
Tiago Dias
Tiago Dias 2019 年 2 月 11 日
コメント済み: Tiago Dias 2019 年 2 月 11 日
Hello,
In my directory I want to be able to creade a Folder, call a function do perform some calculations, and the results of those calculation i want to save in a subfolder of the folder. I am able to created the folder and subfolder, but the file is saved in my main directory, not even in Folder
Folder = 'Folder';
mkdir(Folder)
A = ones(5,1)*(1:5)
B = functionTiago(A,Folder);
% The function is attached
How to save B in the function file if possible inside the subfolder?
If not possible how to save B in the mfile inside the subfolder

採用された回答

Jan
Jan 2019 年 2 月 11 日
function out = functionTiago(A, Folder)
subFolder = fullfile(Folder, 'SUBFOLDER');
mkdir(subFolder)
out = A + 5;
save(fullfile(subFolder, 'Filename'), 'out');
Use absoulte paths.
  1 件のコメント
Tiago Dias
Tiago Dias 2019 年 2 月 11 日
thanks, perfect!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by