Strings

1 回表示 (過去 30 日間)
M G
M G 2011 年 5 月 26 日
Hey guys,
I would like to input a string and then ask matlab to save a series of data with the file name of already input string. e.g. if the string that is input in the starting point of program is analyzed_data1 how can I assign this string in file_name below? Supposedly that there are several save commands, it would help to avoid frequently typing analysed_data1 every time.
save(fullfile(path,'file_name'));
Thank you so much :)

採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 5 月 26 日
Hi,
you are nearly there, I believe: suppose you write in your program at the top
myfilename = 'analysed_data1';
you just call save with
save(fullfile(path, myfilename));
Titus
PS: you might also want to take a look at uigetfile ...
  5 件のコメント
Titus Edelhofer
Titus Edelhofer 2011 年 5 月 26 日
I guess by now the question is obsolete, because Mehdi asked a somewhat similar question with topic "save path" ...
M G
M G 2011 年 5 月 27 日
I got the problem. You're right. Thanks a lot :)

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

その他の回答 (1 件)

Ivan van der Kroon
Ivan van der Kroon 2011 年 5 月 26 日
Depending on your os the slashes could be different. For instance on opensuse I have to use /
path='temp/matlab.mat';
save(path)
With \ it just makes a string and the \'s are just part of the filename. You can make sure to get the correct one by opening the folder and copying the path from there.
  1 件のコメント
M G
M G 2011 年 5 月 27 日
Thanks Ivan, your comment helped :)

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

カテゴリ

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