Skip to content

fullfile

miscellaneous · scripts/miscellaneous/fullfile.m

: f = fullfile (p1, p2, …)

Join path parts with the platform file separator.

Empty parts are skipped and exactly one separator is placed at every junction. Any part may be a char row, a string scalar or a cellstr; if a cellstr is present the result is a cell array, if a string scalar is present (and no cell) the result is a string.

On Windows, / is accepted as a separator and rewritten to \\, volume-relative drives like C: do not gain a separator before the next part, and a leading UNC prefix \\\\ is preserved. Dot path components (. / .\ / ./) are collapsed unless they are trailing.