LoginSignup
2
1

More than 5 years have passed since last update.

[#matlab] 1行でタイムスタンプを打つ

Last updated at Posted at 2018-07-28

赴くままに書いたら案外通ったのでメモ。Matlabのコードです。

>> timestampRegular = replace(join(split(datestr(now), ' '), '-'), ':', '-'); timestampRegular{1}

ans =

    '28-Jul-2018-19-35-05'

now, datestrとかが時間に関する関数で、それ以外はpythonとかでもよく見る関数と一緒なのですぐ分かると思います。

replaceするとcellが返ってくるのが難点かな。cellは、{1}とか指定すると要素が取り出せます。

 2019/03/27追記

......

>> datestr(now,'yyyy-mm-dd-HH-MM-SS') 
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1