how can i change the path when saving the file ?

6 Ansichten (letzte 30 Tage)
Eng Abeer
Eng Abeer am 18 Dez. 2015
Kommentiert: Eng Abeer am 18 Dez. 2015
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 ?

Akzeptierte Antwort

per isakson
per isakson am 18 Dez. 2015
Replace
wavwrite(y,filename)
by
wavwrite( y, fullfile( pathname, filename) )

Weitere Antworten (1)

Image Analyst
Image Analyst am 18 Dez. 2015
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)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by