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

    %% Create a Function to Handle an Extension
% Create a function called |opentxt| to handle files with a |.txt| extension. 
%
% <include>opentxt.m</include> 
%
%%
% Create a text file.
dlmwrite('myTestFile.txt',[1,2,3,4]);

%%
% Read the data from the file. The |open| function calls the function
% |opentxt| to open the file.
open('myTestFile.txt');