MATLAB Examples

Example genOpen

Contents

Internal open

Open a MATLAB file

%Create an m file in the current directory
copyfile(which('sum.m'),fullfile(cd, 'demoMfile.m'))

%Open that file - internal open
genOpen('demoMfile.m');

External use - file

Open file externally using the OS default program

%Create a png file in the current directory
copyfile(fullfile(matlabroot, 'toolbox', 'matlab', 'guide', ...,
'guitools', 'eraser.png'), fullfile(cd, 'demoPngfile.png'));

%Open an image - external open
genOpen('demoPngfile.png');

External use - folder

Open folder externally using the OS default explorer program

%Create a folder in the current directory
demoFolder = fullfile(cd, 'demoFolder');
mkdir(demoFolder);

%Open a folder - external open
genOpen(demoFolder);