This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Folder into which AttachedFiles are written


folder = getAttachedFilesFolder
folder = getAttachedFilesFolder(FileName)



Character vector indicating location where files from job's AttachedFiles property are placed

FileNameCharacter vector specifying all or part of the attached file or folder name


folder = getAttachedFilesFolder returns the path to the local folder into which AttachedFiles are written on the worker. This function returns an empty array if it is not called on a MATLAB® worker.

folder = getAttachedFilesFolder(FileName) returns the path name to the specified attached folder on the worker, or the folder containing the specified attached file. FileName can match either the full name of the attached file or folder, or on the ending part of the name. Multiple match results return a cell array.

If you have attached a folder, this does not match on file names within that folder.

Suppose you attach the folder 'C:\monday\tuesday\wednesday\thursday', which on the workers is stored in /tmp/MDCS/tp12345. The following table displays the results of various match attempts.

Specified Matching Character Vector ArgumentResult
getAttachedFilesFolder('C:\monday')Empty result, because 'C:\monday' is only the start of the path, and does not include 'thursday'
getAttachedFilesFolder('wednesday')Empty result, because 'wednesday' is in the middle of the path and does not include 'thursday'
getAttachedFilesFolder('thurs')Empty result, because 'thurs' is not the ending of the folder name.


Attach a folder to a parallel pool, then find its location on the worker to execute one of its files.

myPool = parpool;
    folder = getAttachedFilesFolder('mydir');
    oldFolder = cd(folder);  % Change to that folder
    [OK,output] = system('myExecutable');
    cd(oldFolder);           % Change to original folder

Attach an executable file to a parallel pool, then change to its folder for accessing and processing some data.

myPool = parpool;
    system('myExecutable');   % Now on MATLAB path
    folder = getAttachedFilesFolder('myExecutable');
    oldFolder = cd(folder);
    fid = open('myData.txt'); % Access data file
        % Process fid
    cd(oldFolder);            % Change back to the original folder
Was this topic helpful?