Function: testmatfile

CALL:

DESCRIPTION:

provide name for file with testdata CALL Save a file with testdata. Derive name from current m-file: nm=testmatfile Save a file with testdata. Set name to "fname" nm=testmatfile(fname) Load a file with testdata. Read data from current mfile+tstmat extension nm=testmatfile(mfilename,'load') Load a file with testdata. Read data from "fname" nm=testmatfile(fname,'load') INPUT fname name of a valid m-file. Without path and withoud extension ".m" ACTION ACTION='save' ==> save data from workspace of caller to dedicated file ACTION='load' ==> load data from dedicated file and save these to workspace of caller EXAMPLE (1) % The next lines must be executed at least once: nm=testmatfile(mfilename); eval(['save',nm]); % The next loads test data into memory: testmatfile(mfilename,'load'); EXAMPLE (2) function exampleUsingTestMatfile(arg1,arg2,arg3) if nargin==0 %derive name of file with sample data nm=testmatfile('exampleUsingTestMatfile'); %save(nm); %enable this line to save sample data load(nm,'-mat');%load sample data %call function using sample data exampleUsingTestMatfile(arg1,arg2,arg3) return end