fopen / doesnt work with whole file path ?

Hey Guys, why doesnt fopen work with the whole filepath ?
Does not work
afs/ipp-garching.mpg.de/home/e/e119/MatLabGUI/Prototyp/seth_plots/seth_31050.dat
works perfect
seth_plots/seth_31050.dat
I currently use matlab in the fodler: Prototyp.

 Réponse acceptée

Image Analyst
Image Analyst le 27 Sep 2014

0 votes

That's not the whole file path - it's a relative path. It probably goes off the current folder and you don't have an afs folder in the current folder. Just specify the whole path, starting from the drive letter, or make sure that folder tree structure is contained in the current folder, and you should be fine.

3 commentaires

Max Müller
Max Müller le 27 Sep 2014
the problem is they want an interactive call of the function...so i am using uigetfile to get the path. Now there are two ways: somehow I get the current path the folder is in or I get the path to the file beginning in the folder.
The reason I cant just type in the current path is: I dont and maybe never will know the path where they use my program.
Max Müller
Max Müller le 27 Sep 2014
got it pwd
Try this snippet:
% 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
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by