Syntax
ejectvolume([vnames])
Input Parameter
vnames : | | name of voume or directory of volume |
Examples
ejectvolume('/Volumes/AP5TIMLUETH')
Copyright 2021-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, ejectvolume
, is designed to unmount and eject an external drive, such as an SD card, on macOS systems. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- vnames: This parameter represents the name of the volume or the directory of the volume to be ejected. It can be provided as a string or a cell array of strings.
Algorithm Steps
- The function starts by defining a default list of volume names in the variable
vnames
. These are potential names for the volumes that might be ejected.
- The function
getfuncparams
is called with the arguments 1
, varargin
, and vnames
. This function is assumed to process the input parameters and return the appropriate volume names to be used.
- The function checks if
vnames
is not a cell array and if the directory exists using exist(vnames, 'dir')
. If true, it assigns vnames
to dname
.
- If the above condition is false, it calls the function
existvolume
with vnames
to determine the directory name dname
.
- The function checks if the system is a macOS using
ismac
and if dname
is not empty.
- If both conditions are met, it constructs a system command
scomm
using sprintf
to format the string 'diskutil eject %s'
with dname
.
- The system command
scomm
is executed using the system
function, which attempts to eject the specified volume.
This function is specifically designed for macOS and relies on the diskutil
command to perform the ejection of the volume.
Algorithm explaination created using ChatGPT on 2025-08-18 23:45. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21