Because of the disparity in the two sensors I had to read in the two sensors independently. The sensor one is the fist 124 bands and sensor two 231 bands. to do this I created 2 zeros mask that could be use to fill
pixswir=zeros(231,length(listp));
pixVnir=zeros(124,length(listp));
The first vector of wavelength was grabbed using a for loop to match each point to my list of points which I called VarName2 for y and VarName1 for x coordinates.
for i = 1:length(listp)
%grabs all the pixel values in the z direction
pix = img(VarName2(i),VarName1(i),:);
pixVnir(:,i)=pix(1:124);
end
I used a similar posses for the other set but i had to create a new x coordinate based on the offset of the two sensors i.e.
tempVar=zeros(length(listp),1);
for ii = 1:length(listp)
tempVar(ii)=VarName1(ii)+Disoffset(ii);
end
Then it could be pressed the same as the first only with the tail end of the bands "pixswir(:,i)=pix2(131:end);" This allowed me to append the images to for a new 355 by 20 matrix with each column containing the z vector of that pixel