Referring to other variables in a variable
6 views (last 30 days)
Show older comments
Say I have a variable that contains a string array: date='1 October 2018' I want to create a new variable containing that variable plus something else (say 'hjhjhj'), like: newdate=date+'hjhjhj' How do I do this? Do I have to convert to their numeric values?
0 Comments
Accepted Answer
the cyclist
on 31 Oct 2018
Edited: the cyclist
on 31 Oct 2018
The way you have defined date there, it is a character array, not a string array. In that case, you can simply concatenate them like this:
date='1 October 2018'
newdate = [date 'hjhjhj']
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!