Rank: 41537 based on 0 downloads (last 30 days) and 0 file submitted
photo

Laurence K

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Laurence K
Updated File Comments Rating
03 Jun 2010 fix_lines Improves the style of lines in MATLAB generated eps files Author: Oliver Woodford

Hi, I like this code - it has come in handy!

I was thinking that since the code has some error checking at the top, it should probably also take account of the situation where the file can't be opened. If that's the case at the moment (say the file isn't there) the line:

fh = fopen(fname, 'rt');

returns -1 into fh. That could be checked and acted on below that, for example like this:

[fh, fMsg] = fopen(fname, 'rt');
if ( fh == -1 )
disp(['Error opening file: ' fMsg]);
return;
end

Otherwise, an error is thrown when the fread line is executed, and it goes to close the file on the fclose line just below it. Since it's not open, this throws another error and the code exits with an error before the rethrow line is executed.

Contact us