function out = prepweights2cations(thelabels,gflabels,gf)
%out = prepweights2cations(thelabels,gflabels,gf)
%This function prepares the data required to transform oxide weights into cations
%INPUT
%thelabels = contains the order that the elements are in the input data. This is used
%to suffle the gf information properly (cell array of strings).
%gflabels = a cell array of strings that holds the information about the order of 
%the gf data.
%gf = a double array that holds unsorted information about the gramformula weight, number
%of cations per oxide unit and the charge of the cation for each element considered
%OUTPUT
%out = a structure that contains the neccesary values for conversion between cations and weights
%   that is now in the proper order and further subdevided for actual use in the conversion.
%
%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 17, 2003
gfcolumns = GetColumnsGeneral(gflabels,thelabels);
gramformula = gf(1,[gfcolumns{2,:}]);
cations = gf(2,[gfcolumns{2,:}]);
charges = gf(3,[gfcolumns{2,:}]);
out = struct('Oxygens',{0},'gramformula',{gramformula},'cation',{cations},'charges',{charges}); 