Avoid the inner loop:
T = load('T.mat').T
T = 33133x41 table
Date SystemTime RunTime CameraPositionX CameraPositionY CameraPositionZ CameraRotationX CameraRotationY CameraRotationZ CameraRotationW LHType LHGrabbedObject LHPositionX LHPositionY LHPositionZ LHRotationX LHRotationY LHRotationZ LHRotationW RHType RHGrabbedObject RHPositionX RHPositionY RHPositionZ RHRotationX RHRotationY RHRotationZ RHRotationW PupilDiameterLeft PupilDiameterRight GazePositionX GazePositionY GazePositionZ FocusInfo LastRequestedBurger LastRequestedDrink OrderNumber OrderStatus LastEvent ManualRegistering VarName41
__________ __________ _______ _______________ _______________ _______________ _______________ _______________ _______________ _______________ ________ _______________ ___________ ___________ ___________ ___________ ___________ ___________ ___________ _________ _______________ ___________ ___________ ___________ ___________ ___________ ___________ ___________ _________________ __________________ _____________ _____________ _____________ _________ ___________________ __________________ ________________ ___________ _________ _________________ _________
15-11-2023 NaT 115.8 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28039 1.3604 0.29594 0.52423 0.088768 -0.067117 -0.84427 RightHand null 0.076785 1.417 0.25962 0.57927 -0.093584 0.060118 -0.80751 3.52 3.22 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.84 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28036 1.3603 0.29598 0.52418 0.088865 -0.06694 -0.84431 RightHand null 0.076829 1.417 0.25964 0.57926 -0.093948 0.060058 -0.80748 3.52 3.19 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.85 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28035 1.3601 0.29597 0.5239 0.088938 -0.067109 -0.84446 RightHand null 0.076925 1.417 0.25952 0.57946 -0.094704 0.06007 -0.80724 3.52 3.22 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.85 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28034 1.36 0.29597 0.52382 0.088891 -0.067402 -0.84449 RightHand null 0.077037 1.4171 0.25949 0.57962 -0.094954 0.060195 -0.8071 3.52 3.22 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.86 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28038 1.3599 0.29594 0.52374 0.088781 -0.067576 -0.84454 RightHand null 0.077072 1.4171 0.2594 0.57976 -0.095229 0.060112 -0.80697 3.53 3.19 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.87 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28029 1.3599 0.29592 0.52365 0.088697 -0.067646 -0.8446 RightHand null 0.077094 1.417 0.25934 0.57995 -0.095401 0.060247 -0.8068 3.53 3.22 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.88 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28026 1.3598 0.29599 0.52374 0.088904 -0.067509 -0.84453 RightHand null 0.077149 1.417 0.25928 0.58001 -0.095044 0.060641 -0.80677 3.56 3.21 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.89 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.2803 1.3598 0.29608 0.52373 0.089089 -0.067429 -0.84452 RightHand null 0.077182 1.4171 0.25925 0.58007 -0.094702 0.060962 -0.80674 3.56 3.19 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.9 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28024 1.3598 0.29599 0.52371 0.089113 -0.067484 -0.84453 RightHand null 0.077223 1.4171 0.25922 0.58002 -0.094394 0.060927 -0.80682 3.56 3.19 0.06 -0.07 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.91 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28024 1.3598 0.29606 0.52364 0.089165 -0.067725 -0.84455 RightHand null 0.0772 1.4171 0.25921 0.57998 -0.094445 0.060253 -0.80689 3.51 3.21 0.03 -0.08 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.92 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28019 1.3595 0.29597 0.52352 0.089106 -0.06791 -0.84462 RightHand null 0.0773 1.4169 0.25921 0.57996 -0.09467 0.05975 -0.80692 3.53 3.24 -0.02 -0.08 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.93 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28008 1.3595 0.29597 0.52339 0.089077 -0.06792 -0.8447 RightHand null 0.077376 1.417 0.25917 0.58005 -0.095062 0.059262 -0.80684 3.48 3.25 -0.05 -0.08 1 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.94 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28008 1.3595 0.29608 0.52317 0.089007 -0.067806 -0.84485 RightHand null 0.077386 1.417 0.25912 0.58008 -0.095141 0.059264 -0.80681 3.53 3.22 -0.06 -0.08 0.99 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.96 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28007 1.3594 0.29613 0.52301 0.088863 -0.067627 -0.84498 RightHand null 0.077434 1.4171 0.25909 0.58007 -0.095219 0.059544 -0.80679 3.42 3.19 -0.05 -0.08 0.99 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.97 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.27989 1.3595 0.29614 0.5228 0.088734 -0.067379 -0.84514 RightHand null 0.077619 1.4172 0.25903 0.57992 -0.095414 0.059866 -0.80685 3.41 3.2 -0.06 -0.09 0.99 null "" "" No current order "" "" "" ""
15-11-2023 NaT 115.98 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.27988 1.3594 0.29622 0.52261 0.088784 -0.067391 -0.84525 RightHand null 0.077741 1.4172 0.25897 0.57993 -0.095369 0.060203 -0.80683 3.39 3.2 -0.06 -0.09 0.99 null "" "" No current order "" "" "" ""
if width(T)>=37
V = str2double(string(T{:,37}));
V(isnan(V)) = 0;
T = convertvars(T,37,'double');
T{:,37} = V
end
T = 33133x41 table
Date SystemTime RunTime CameraPositionX CameraPositionY CameraPositionZ CameraRotationX CameraRotationY CameraRotationZ CameraRotationW LHType LHGrabbedObject LHPositionX LHPositionY LHPositionZ LHRotationX LHRotationY LHRotationZ LHRotationW RHType RHGrabbedObject RHPositionX RHPositionY RHPositionZ RHRotationX RHRotationY RHRotationZ RHRotationW PupilDiameterLeft PupilDiameterRight GazePositionX GazePositionY GazePositionZ FocusInfo LastRequestedBurger LastRequestedDrink OrderNumber OrderStatus LastEvent ManualRegistering VarName41
__________ __________ _______ _______________ _______________ _______________ _______________ _______________ _______________ _______________ ________ _______________ ___________ ___________ ___________ ___________ ___________ ___________ ___________ _________ _______________ ___________ ___________ ___________ ___________ ___________ ___________ ___________ _________________ __________________ _____________ _____________ _____________ _________ ___________________ __________________ ___________ ___________ _________ _________________ _________
15-11-2023 NaT 115.8 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28039 1.3604 0.29594 0.52423 0.088768 -0.067117 -0.84427 RightHand null 0.076785 1.417 0.25962 0.57927 -0.093584 0.060118 -0.80751 3.52 3.22 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.84 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28036 1.3603 0.29598 0.52418 0.088865 -0.06694 -0.84431 RightHand null 0.076829 1.417 0.25964 0.57926 -0.093948 0.060058 -0.80748 3.52 3.19 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.85 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28035 1.3601 0.29597 0.5239 0.088938 -0.067109 -0.84446 RightHand null 0.076925 1.417 0.25952 0.57946 -0.094704 0.06007 -0.80724 3.52 3.22 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.85 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28034 1.36 0.29597 0.52382 0.088891 -0.067402 -0.84449 RightHand null 0.077037 1.4171 0.25949 0.57962 -0.094954 0.060195 -0.8071 3.52 3.22 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.86 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28038 1.3599 0.29594 0.52374 0.088781 -0.067576 -0.84454 RightHand null 0.077072 1.4171 0.2594 0.57976 -0.095229 0.060112 -0.80697 3.53 3.19 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.87 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28029 1.3599 0.29592 0.52365 0.088697 -0.067646 -0.8446 RightHand null 0.077094 1.417 0.25934 0.57995 -0.095401 0.060247 -0.8068 3.53 3.22 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.88 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28026 1.3598 0.29599 0.52374 0.088904 -0.067509 -0.84453 RightHand null 0.077149 1.417 0.25928 0.58001 -0.095044 0.060641 -0.80677 3.56 3.21 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.89 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.2803 1.3598 0.29608 0.52373 0.089089 -0.067429 -0.84452 RightHand null 0.077182 1.4171 0.25925 0.58007 -0.094702 0.060962 -0.80674 3.56 3.19 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.9 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28024 1.3598 0.29599 0.52371 0.089113 -0.067484 -0.84453 RightHand null 0.077223 1.4171 0.25922 0.58002 -0.094394 0.060927 -0.80682 3.56 3.19 0.06 -0.07 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.91 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28024 1.3598 0.29606 0.52364 0.089165 -0.067725 -0.84455 RightHand null 0.0772 1.4171 0.25921 0.57998 -0.094445 0.060253 -0.80689 3.51 3.21 0.03 -0.08 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.92 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28019 1.3595 0.29597 0.52352 0.089106 -0.06791 -0.84462 RightHand null 0.0773 1.4169 0.25921 0.57996 -0.09467 0.05975 -0.80692 3.53 3.24 -0.02 -0.08 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.93 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28008 1.3595 0.29597 0.52339 0.089077 -0.06792 -0.8447 RightHand null 0.077376 1.417 0.25917 0.58005 -0.095062 0.059262 -0.80684 3.48 3.25 -0.05 -0.08 1 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.94 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28008 1.3595 0.29608 0.52317 0.089007 -0.067806 -0.84485 RightHand null 0.077386 1.417 0.25912 0.58008 -0.095141 0.059264 -0.80681 3.53 3.22 -0.06 -0.08 0.99 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.96 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.28007 1.3594 0.29613 0.52301 0.088863 -0.067627 -0.84498 RightHand null 0.077434 1.4171 0.25909 0.58007 -0.095219 0.059544 -0.80679 3.42 3.19 -0.05 -0.08 0.99 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.97 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.27989 1.3595 0.29614 0.5228 0.088734 -0.067379 -0.84514 RightHand null 0.077619 1.4172 0.25903 0.57992 -0.095414 0.059866 -0.80685 3.41 3.2 -0.06 -0.09 0.99 null "" "" 0 "" "" "" ""
15-11-2023 NaT 115.98 -0.11 1.62 0.01 -0.14 -0.01 -0.05 -0.99 LeftHand null -0.27988 1.3594 0.29622 0.52261 0.088784 -0.067391 -0.84525 RightHand null 0.077741 1.4172 0.25897 0.57993 -0.095369 0.060203 -0.80683 3.39 3.2 -0.06 -0.09 0.99 null "" "" 0 "" "" "" ""
Is the column position reliable? Perhaps you should use the column name and/or the column type.
Note that you might also be able to modify the file import options to import that column directly as numeric.