MATLAB: How can I arrange the answer into an array

1d data

my code is:
allData = xlsread('C:\in.xlsx');
%time vector and a column array of temperatures
timeVec = allData(:,1);
tempVecs = allData(:,2:end);
%Find the peak time of all temperatures
[maxTemps, maxIndices] = max(tempVecs);
timeVec(maxIndices);
%Find the times that temperature increases
for i =1:5;
for j=200:50:850;
firstIndex = find(tempVecs(:,i) > j, 1, 'first');
lastIndex = find(tempVecs(:,i) > j, 1, 'last');
a=timeVec(firstIndex);
b=timeVec(lastIndex);
residence=b-a;
end
end
Output is like
residence =
82.6500
residence =
73.6500
residence =
63.366
residence =
52.3000
residence =
40.5167
residence =
26.2000
.............
total 70 data.
each column has 14 data point. I want to arrange the residence time in a one file that has 5 column and each column contains 14 data. How can I do that? Any one can help me. A very good guy help me to do the above code. thank good guy.

Best Answer

allData = xlsread('C:\in.xlsx');
%time vector and a column array of temperatures
timeVec = allData(:,1);
tempVecs = allData(:,2:end);
%Find the peak time of all temperatures
[maxTemps, maxIndices] = max(tempVecs);
(maxIndices);
% initialise a counter
count=0;
%Find the times that temperature increases
for i =1:5;
for j=200:50:850;
count=count+1;
firstIndex = find(tempVecs(:,i) > j, 1, 'first');
lastIndex = find(tempVecs(:,i) > j, 1, 'last');
a=timeVec(firstIndex);
b=timeVec(lastIndex);
%store a vector residecnce 1x70
residence(count)=b-a;
end
end
%reshape a vector residence
residence=reshape(residence,14,5)