SO503, Spring 2010
Matlab Reading of a Text File
You are to write Matlab code to parse one of the reflectance spectra that we looked at two weeks ago with the hyperspectral imagery. You should insure that the spectra files you read have four columns; most of the computers in the lab have old files with only three columns of data.
Your code must be capable of taking only a single input (the file name) and doing everything else automatically. This would be a preliminary step to opening thousands of files to find the one with the best match for a particular point in a hyperspectral scene, and as such you cannot afford to manually preprocess the files or use a data importer to get the data into Matlab.
The code at http://blinkdagger.com/matlab/parse-data should provide a good starting point in terms of laying out the steps you must take, and the Matlab resources that will do the job. You are highly encouraged to read it before coming to class so that you can ask intelligent questions.
The comment by Quan Quach discusses using a while loop instead of a for loop, and is highly recommended.
Insure that you understand what a line like "y(r) = str2num(readin(22:30));" does. This file has no alphanumeric entrees, but you should be prepared to deal with them, and you will see a case later when you must be able to ignore ASCII text characters in each line..
You will turn in:
An m-file.
Graphs like the one below for two different materials, produced with your m-file.
