function controlstruct = PhaseCheckPrep(extradata,ExtraLabel,controlstruct)
%The purpose PhaseCheckPrep is to the read the user supplied phase identification
%and save it as controlstruct.PhaseCheckVector this function is only called 
%if PhaseCheck == 1 in the input file.The user supplied
%phase classification is provided in a column called "MineralName" in the 
%input .csv file
%
%INPUT
%extradata = a cell array of the data not used by APHID but provided in the
%input .csv file
%ExtraLabel = a cell array of strings that are the labels to the columns
%in extradata
%controlstruct = created by APHIDengine.m, a structure that contains the
%basic information required to run APHID
%
%OUTPUT
%controlstruct = modified by adding a cell array of strings (PhaseCheckVector)
%that are the user supplied IDs
%
%Written by K. Steffen (ksteffen@unm.edu) at the University of New Mexico,
%Department of Earch and Planetary Science
%Copyright 2003 Kurt Steffen
%
%Last Modified June 20, 2003

WhichExtra = GetColumnsGeneral3(ExtraLabel,{'MineralName'});
WhichExtra = WhichExtra{2,1};

if WhichExtra == -1
	error(sprintf('A column called "MineralName" could not be found in %s, \n either turn off PhaseCheck or supply this column',controlstruct.infile));
end
controlstruct.PhaseCheckVector = extradata(:,WhichExtra);