Syntax
[user,host]=username
Output Parameter
user : | | user name |
host : | | host name |
Examples
[u,h]=username
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 retrieves the current user's name and the host's name using Java methods in MATLAB. It also allows for optional date formatting based on input parameters.
Input Parameters
- varargin: Optional input that can specify a date format tag.
Output Results
- user: The user name, potentially appended with a date string.
- host: The host name of the machine.
Algorithm Steps
- Retrieve the user name using Java's
System.getProperty('user.name')
.
- Retrieve the host name using Java's
InetAddress.getLocalHost.getHostName
.
- Call
getfuncparams
to obtain the datetag
from varargin
.
- Use a switch statement to handle different
datetag
values:
- Case '': No action is taken.
- Case 'roman': Append the user name with the current date in Roman numeral format using
datestrroman(now)
.
- Case {'std','arab','normal','yyyy'}: Append the user name with the current date in the format 'yyyy-mm-dd' using
datestr(clock,29)
.
- Otherwise: Append the user name with the current date using the format specified by
datetag
.
- If no output arguments are specified, print the host name using
dbprintf
.
Algorithm explaination created using ChatGPT on 2025-08-18 23:21. (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