Watch this Author's files
@Ken Why is strtrim better? Are you having problems with whitespace at the beginning of your hostname string?
Many thanks to Manuel Marin for posting this information.
As an aside, things like this are only "trivial" to those who already know the answer.They are critical to those who are searching for answers.
A spark should never be put out. Rather, it should be fanned. Posters should be encouraged in their attempts to serve the community.
Helpful.
Maybe useful to put this at the end hostname = hostname(hostname ~= 10);
to remove the newline character at the end of the string (on the one computer I've tested it on).
Contact us at files@mathworks.com