how can i change the path when saving the file ?

6 ビュー (過去 30 日間)
Eng Abeer
Eng Abeer 2015 年 12 月 18 日
コメント済み: Eng Abeer 2015 年 12 月 18 日
when i am saving the file , only i can change the name of it but the path stay in file(.m)path. i want to save the file in a path different from the (.m)file how can i do this ? look at this code :
[filename,pathname] = uiputfile({'*.wav', '*.wav'}, 'Save current file as');
wavwrite(y,filename)
it saves the file in the same path of (.m)file , i want to save it in different path ?

採用された回答

per isakson
per isakson 2015 年 12 月 18 日
Replace
wavwrite(y,filename)
by
wavwrite( y, fullfile( pathname, filename) )

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 12 月 18 日
Here's my snippet that I always give people. It also handles if people click Cancel. Feel free to adapt it.
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by