Inserting current date in string

8 ビュー (過去 30 日間)
Syed Abbas
Syed Abbas 2012 年 1 月 17 日
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 件のコメント
Syed Abbas
Syed Abbas 2012 年 1 月 17 日
Thanks!

サインインしてコメントする。

その他の回答 (1 件)

Thomas
Thomas 2012 年 1 月 17 日
Use:
str=['Today is ',date]
  1 件のコメント
Syed Abbas
Syed Abbas 2012 年 1 月 17 日
Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by