Hello, I have a 1989 x 8 table with column names [ wavelength, Dark, Reference, Amplitude_Capture1, Amplitude_Capture2, Amplitude_Capture3, Amplitude_Capture4, Amplitude_Capture5] I would like to create a 3D array from this table with every first column of the array to be the information of the Wavelength and every second column the amplitude_capture. This would result in:
- Wavelength and Amplitude_Capture1 in My_Array(:,:,1)
- Wavelength and Amplitude_Capture2 in My_Array(:,:,2) etc.
I solved this know with the following code:
% code
for i = 1:1:FolderIndex-1
name=MyFolderInfo(i).name
Names(1,i)=name
MyTable=importfile(name,3,inf)
TableToArrayStr(:,1:8)=table2array(MyTable(:,1:8));
while ColIndex < 9
AmplitudeArray(:,4,(ArrayDimension+Index))=TableToArrayStr(:,ColIndex)
AmplitudeArray(:,1:3,(ArrayDimension+Index))=TableToArrayStr(:,1:3)
Index = Index+1
ColIndex=ColIndex+1
end
ColIndex=4
end
this is a time consuming effort I wonder if it can be faster / optimized.
I did allocate the Arrays before use.
Thanks.