Formatted documentation for the GetWritableFolder function.

Return a folder with write permission or error.

If the output folder doesn't already exist, this function will attempt to create it. This function should provide a reliable and repeatable location to write files.




Output arguments

f Char array with the full path to the writable folder. This does not contain a trailing filesep.
status A scalar double ranging from 0 to 3. See the table below for details.

Status value

Status value Contents of f Notes
0 Empty char. This requires ErrorOnNotFound to be set to false and denotes a failure to find a folder.
1 A folder in %APPDATA%. This is valid for Windows.
A folder under home_dir\Documents\. This is valid for Mac/Unix.
2 A folder in tempdir(). -
3 A subdirectory of the current working directory. -

Input arguments

Name,Value Change optional parameters. See below for the list of options that can be changed.
optionstruct Instead of the Name,Value, parameters can also be entered in a struct. Missing fields will be set to the default values.

Name,Value pairs

ForceStatus Retrieve the path corresponding to the status value. Setting this to 0 will ignore this parameter.
ErrorOnNotFound Throw an error when failing to find a writeable folder.

Compatibility, version info, and licence

Compatibility Windows XP/7/10 Ubuntu 20.04 LTS MacOS 10.15 Catalina
ML R2020b W10: works not tested not tested
ML R2018a W10: works works not tested
ML R2015a W10: works works not tested
ML R2011a W10: works works not tested
ML R2010b not tested works not tested
ML R2010a W7: works not tested not tested
ML 7.1 (R14SP3) XP: works not tested not tested
ML 6.5 (R13) W10: works not tested not tested
Octave 6.1.0 W10: works not tested not tested
Octave 5.2.0 W10: works works not tested
Octave 4.4.1 W10: works not tested works

Version: 1.0
Date:    2021-02-19
Author:  H.J. Wisselink
Licence: CC by-nc-sa 4.0 ( )
Email = 'h_j_wisselink*alumnus_utwente_nl';
Real_email = regexprep(Email,{'*','_'},{'@','.'})