None.
Open in the MATLAB editor: x04ad_example
function x04ad_example fprintf('x04ad example results\n\n'); file = 'success.res'; % Associate unit number iounit=4 with filename success.res iounit = int64(4); % Open File for writing to mode = int64(1); [ifail] = x04ac(iounit, file, mode); % write to file here via iounit using x04ba fprintf('The file named %s was opened for writing on unit number %d\n', ... file,iounit); rec = 'This file was successfully opened for writing'; x04ba(iounit,rec); % Close File associated with unit number iounit=4 [ifail] = x04ad(iounit); fprintf('Unit number %d has been closed\n\n', iounit); % Open File for reading mode = int64(0); [ifail] = x04ac(iounit, file, mode); % read from file here via iounit using x04bb fprintf('The file named %s was opened for reading on unit number %d\n', ... file,iounit); reclen = int64(50); [rec, ifail] = x04bb(iounit, reclen); fprintf('The following line was read from unit %d:\n----\n',iounit); disp(rec); fprintf('----\n'); % Close File associated with unit number iounit=4 [ifail] = x04ad(iounit); fprintf('\nUnit number %d has been closed\n', iounit); delete(file);
x04ad example results The file named success.res was opened for writing on unit number 4 Unit number 4 has been closed The file named success.res was opened for reading on unit number 4 The following line was read from unit 4: ---- This file was successfully opened for writing ---- Unit number 4 has been closed