user3813057
user3813057

Reputation: 911

To delete a file, located in the search path, in MATLAB

I have a file located in /path/to/Matlab/myData.mat. The path /path/to/Matlab has been in the search path. I launch Matlab from /path/to/Matlab/workspace/.

However, the command if (exist('myData.mat','file')==2) delete('myData.mat'); returns error saying that File myData.mat cannot be found.

There is only one file named myData.mat among all the search paths. Is it mandatory to use absolute or relative path when call the delete() function providing the location has been added to the search path?

My OS is Ubuntu 16, and Matlab v2015b.

Upvotes: 0

Views: 66

Answers (1)

matlabgui
matlabgui

Reputation: 5672

Use which to find the full path

Upvotes: 1

Related Questions