mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	All of these code samples currently are mis-identified in my repositories. I'm donating them to the cause.
		
			
				
	
	
		
			28 lines
		
	
	
		
			953 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			953 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
function settings = overwrite_settings(defaultSettings, overrideSettings)
 | 
						|
% function settings = overwrite_settings(defaultSettings, overrideSettings)
 | 
						|
% Returns the settings based on a combination of the defaults and the override settings.
 | 
						|
%
 | 
						|
% Parameters
 | 
						|
% ----------
 | 
						|
% defaultSettings : structure
 | 
						|
%   A structure with all of the default settings.
 | 
						|
% overrideSettings : structure
 | 
						|
%   Contains any settings that should override the defaults.
 | 
						|
%
 | 
						|
% Returns
 | 
						|
% -------
 | 
						|
% settings : structure
 | 
						|
%   A stucture containing the overrideSettings and any defaults that weren't
 | 
						|
%   supplied in the overrideSettings.
 | 
						|
 | 
						|
% add the default options if not specified by the user
 | 
						|
overrideNames = fieldnames(overrideSettings);
 | 
						|
defaultNames = fieldnames(defaultSettings);
 | 
						|
notGiven = setxor(overrideNames, defaultNames);
 | 
						|
settings = overrideSettings;
 | 
						|
if length(notGiven) > 0
 | 
						|
    for i = 1:length(notGiven)
 | 
						|
        settings.(notGiven{i}) = defaultSettings.(notGiven{i});
 | 
						|
    end
 | 
						|
end
 |