フィルターのクリア

How can i put a string from an array into the filename?

5 ビュー (過去 30 日間)
m8freckles
m8freckles 2016 年 10 月 27 日
コメント済み: m8freckles 2016 年 10 月 28 日
Hi, I've created a GUI and I want to save some data in a file.xls. To do this I use:
[file,path]=uiputfile('filename.xls', 'Save file name')
My problem is that i want the filename to be like "name_surname_clock", where name and surname are from an array created in the file.m, while clock is the actual date and time, that i obtain using:
format shortg
time=clock.
Can you please help me? Thank you.

採用された回答

James Tursa
James Tursa 2016 年 10 月 27 日
編集済み: James Tursa 2016 年 10 月 27 日
E.g., assuming you have variables named "name" and "surname" for the first two parts and simply using datestr for the third part:
d = datestr(clock);
d(d==' ') = '_';
filename = [name '_ ' surname '_' d '.xls'];
Or you could use some other string format for the data and time of course.
  1 件のコメント
m8freckles
m8freckles 2016 年 10 月 28 日
Thank you so much! You saved me :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by