%% textscan_example.m
% This is an example of using textscan command
% to import data

%% Open File 
fid=fopen('Sample_Data_File.txt');
numCols = 6;
numHeaders = 1;
% Define Formats
format_header = repmat('%s ', 1, numCols);
format_data = ['%s ', repmat('%f ', 1, numCols-1)];

%% Read Data
% Read Data using defined formats
header = textscan(fid, format_header, 1);
data = textscan(fid, format_data);
% Close file
fclose(fid);

%% Display Results

disp('Header row');
[header{:}]

disp('Elements from column 3');
data{1, 3}(:)

disp ('Elements of first and last columns');
[first,~, ~, ~, ~, ~, last] = deal(data)

