www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/AddUpdateorRemoveFileFormatfromRegistryExample.m

    %% Add, Update, or Remove File Format from Registry  
% Add a hypothetical file format, ABC, to the image file format registry.
% Update, and then remove the format.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a structure with seven fields, defining values for the new format. 
formatStruct = struct('ext','abc','isa',@isabc,...
    'info',@abcinfo,'read',@readabc,'write','',...
    'alpha',0,'description','My ABC Format') 

%%
% |formatStruct| is a 1-by-1 structure with seven fields. In this example,
% the |write| field is empty.  

%% 
% Add the new format to the file format registry. 
registry = imformats('add',formatStruct);  

%% 
% Redefine the format associated with the extension, |abc|, by adding a
% value for the |write| field. Then, update the registry value for the format. 
formatStruct2 = struct('ext','abc','isa',@isabc,...
    'info',@abcinfo,'read',@readabc,'write',@writeabc,...
    'alpha',0,'description','My ABC Format');

registry = imformats('update','abc',formatStruct2);  

%% 
% Remove the format with the extension, |abc|, from the file format registry. 
registry = imformats('remove','abc');