Be the first to rate this file! 8 Downloads (last 30 days) File Size: 1.62 KB File ID: #33715

Loads Preferences File

by

 

This function loads a .mat file containing a structure and appends all the loaded fields and respect

| Watch this File

File Information
Description

This function loads a .mat file containing a structure and appends all the loaded fields and respective values to an older structure.
Any new fields are simply added.

This is very useful when working with preferences files, where you may create a structure with the default values and then load the user preferences from previously saved file.
If for instance, the user file is older and doesn't contain newer fields, the default ones with fill the spots.

PREFS_NEW = LOAD_PREF_FILE(PREFS_DEFAULT, PREFS_FILE) , PREFS_DEFAULT and PREFS_NEW are structure type. PREFS_FILE is a string containing the file name to be loaded.

Required Products MATLAB
MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
11 Nov 2011 Tiago

I forgot to mention, the PREFS_DEFAULT to be loaded, must be saved using the form:
save(filename, '-struct', structName, fieldNames)

Contact us