function future = createFolder(pool, name)
% parallel.pool.createFolder creates a subdirectory on the workers
%    F = parallel.pool.createFolder(POOL, SUBFOLDER) executes on each worker to create
%    per-worker and per-host subfolders named SUBFOLDER. F is parallel.FevalOnAllFuture
%    which can be used to ensure success of the operation. It is not an error if SUBFOLDER
%    already exists.

% Copyright 2014-2017 The MathWorks, Inc.

% Convert any string inputs to character vectors
name = convertStringsToChars(name);
                
validateattributes(pool, {'parallel.Pool'}, {'scalar'});
validateattributes(name, {'char'}, {'row', 'nonempty'});
if ~isvarname(name)
    error(message('parallel:pool:InvalidFolderName'));
end
future = createFolder(parallel.internal.pool.FolderManagement.getForPool(pool), name);
end
