from
read_file.m
by Manuel Castillo
reading ascii files
|
| [a,filename,pathname]=read_file
|
function [a,filename,pathname]=read_file
%
%this function read ascii file in columns separates
%by spece or tab, this function open a dialog open file
%and you just pick the file to read
%the out "a" is the matrix of your file
%also you obtain the filename and pathnme (location)
%see also UIGETFILE,UIPUTFILE,FINDSTR,FPRINTF
%
%funcion de lectura de un archivo, desplegando cuadro de abrir como..
%lee cualquier extension de archivo o archivos sin extension...
%al archivo queda en "a" y el nombre y el path del archivo
%tambien se salvan
%"no esta diseado para leer *.mat de matlab
%
%ver ademas UIGETFILE,UIPUTFILE,FINDSTR,FPRINTF
% mics,2000
%
[filename,pathname]=uigetfile('*.*','Load the file to read...');
fin=filename;
fid=fopen(fin,'r');
path(path,pathname);
eval(['load ' filename]);
P=find(filename=='.');
if filename(P+1:P+3)=='mat',
%disp('No se puede leer este tipo de archivo...!!!')
disp('You cant open this type of files with this function..!!!')
disp('use only load filename ...')
return
end
if isempty(P)==0,
eval(['a=' filename(1:P-1) ';']);
else
eval(['a=' filename ';']);
end
|
|
Contact us at files@mathworks.com