uses file extension if possible to determine file type
if no recognizable file extension, assumes delimited data
file type determines data type
uiimport command
GUI interface to import data
textscan command
imports to cell arrays
use for non-standard data formats and large files
try:
help iofun help fileformats uiimport mydata=importdata('Sample_Data_File.txt') textscan_example
%
textscan_example.m - example of using textscan command to
import data fid=fopen('Sample_Data_File.txt'); numCols=10; numHeaders=1; format1=repmat('%s ',1,numCols); format2=repmat('%d ',1,numCols-1); format2=['%s ' format2]; myHeader=textscan(fid,format1,1); myData=textscan(fid,format2); fclose(fid); disp('here are the first 5
elements from column 1 (not including the header row'); myData{1,1}(1:5) disp('here are the 10 elements
from column 9 (not including the header row'); myData{1,9}(1:10) disp('here are the first 8
columns in the header row'); myHeader{1,1:8}