Inserting current date in string

6 次查看(过去 30 天)
Hi,
I have a string such as follows:
st = 'Today is January 17 2012'
How can I automatically insert today's date in this string without manually typing it into the string. I am looking for something of the form:
st = 'Today is datestr(now)' - but obviously this does not produce the desired result.
Thanks,

采纳的回答

bym
bym 2012-1-17
sprintf('today is %s',datestr(now()))

更多回答(1 个)

Thomas
Thomas 2012-1-17
Use:
str=['Today is ',date]

类别

Help CenterFile Exchange 中查找有关 String 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by