Syntax
dname=existvolume([vname])
Input Parameter
Output Parameter
dname : | | matlab path to volume dir; ends always with filesep |
Examples
existvolume('PLATTE LUETH ALL')
existvolume({'PLATTE LUETH ALL2','PLATTE LUETH ALL4','PLATTE LUETH ALL'})
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, existvolume
, is designed to check if a specified volume is mounted on a system running macOS. It returns the full path to the volume's directory if it exists.
Input Parameters
- vname: This is the name of the volume you want to check. It can be a single string or a cell array of strings. If a cell array is provided, the function will return the path of the first existing volume.
Output
- dname: This is the full path to the volume's directory. It always ends with a file separator (filesep). If the volume does not exist, it returns an empty array.
Algorithm Steps
- The function starts by retrieving the volume name using
getfuncparams
. If no volume name is provided, it defaults to 'PLATTE LUETH ALL'.
- If
vname
is a cell array, the function iterates over each volume name in the array:
- For each volume name, it recursively calls
existvolume
.
- If a valid directory path is found, it breaks out of the loop and returns the path.
- If
vname
is not a cell array, the function checks if the operating system is macOS:
- If not, it throws an error indicating the function is only available on macOS.
- It constructs the directory path by appending the volume name to '/Volumes/'.
- It ensures the path ends with a file separator.
- It checks if the directory exists using
exist
:
- If the directory does not exist, it sets
dname
to an empty array.
Example Usage
existvolume('PLATTE LUETH ALL')
: Checks if the volume 'PLATTE LUETH ALL' is mounted and returns its path if it exists.
existvolume({'PLATTE LUETH ALL2','PLATTE LUETH ALL4','PLATTE LUETH ALL'})
: Checks each volume in the list and returns the path of the first one that exists.
Algorithm explaination created using ChatGPT on 2025-08-19 01:13. (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