Reputation: 753
Say I use fopen
to generate a fileID:
fid = fopen('\some\path\to\toto.dat','r')
Is it possible to identify which file has been opened, solely from fid
? For example,
fname = identify(fid);
disp(fname)
>> \some\path\to\toto.dat
Upvotes: 2
Views: 187
Reputation: 607
Yes you can! The code is simply: fname = fopen(fid)
. You can obtain additional information including permission, machine format, and encoding as well. Documentation here: https://www.mathworks.com/help/matlab/ref/fopen.html
Upvotes: 5