Is it possible to force case-sensitivity in MATLAB for file operations like LOAD? -


matlab case-sensitive calling functions, on windows:

>> edit untitled >> untitled cannot find exact (case-sensitive) match 'untitled' 

is there way enforce case sensitivity on windows other functions, load?

>> = 3; >> save a >> load 

the problem code run fine on windows, error if send friend on unix.

one way enforce case-sensitivity functions dealing files, regardless of platform running, write wrapper such functions.

for example, in case of load, came following drop-in replacement:

function varargout = myload(fname, varargin)     % make sure filename ends mat extension     [~,~,ext] = fileparts(fname);     if isempty(ext), fname = [fname '.mat']; end      % open file (searching entire matlab path)     fid = fopen(fname,'r');     if fid < 0, error('file not found'); end      % fullpath opened file, , close file handle     filename = fopen(fid);     fclose(fid);      % extract filename     [~,name,ext] = fileparts(filename);     filename = [name ext];      % compare against original name (case-sensitive)     if ~strcmp(fname,filename)         error('cannot find exact (case-sensitive) match file');     end      % load mat-file     s = load(fname, varargin{:});      % assign output     if nargout > 0         varargout{1} = s;     else         fn = fieldnames(s);         i=1:numel(fn)             assignin('caller', fn{i}, s.(fn{i}))         end     end end 

i may have missed few cases in above implementation, idea..


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -