フィルターのクリア

Trying to save part of a filename that is being read into a variable as the name of the output file

5 ビュー (過去 30 日間)
Mike
Mike 2018 年 3 月 21 日
編集済み: Stephen23 2018 年 3 月 21 日
I have a file called originalfile123.mat and will read it into the function in 'filename'
function xyz (filename,a)
save('filename''a')
I would like the outgoing file to be called originalfile123a.mat, However it is just being saved as 'filename''a'.mat
Thanks

回答 (1 件)

Stephen23
Stephen23 2018 年 3 月 21 日
編集済み: Stephen23 2018 年 3 月 21 日
Try something like this:
function xyz(filename,a)
[fpth,name,ext] = fileparts(filename);
save(fullfile(fpth,[name,'a',ext]),'a')

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by