I have the following for
loop which makes my program runs very slow when the file size is very big. What is the best way to vectorize it.
I read d
This will do what you want
>> pc = str2double([data{:}].')
pc =
0.1033 -0.2737 0.8570 221.0000 196.0000 174.0000 255.0000
0.1054 -0.2731 0.8550 220.0000 195.0000 173.0000 255.0000
...
0.1139 -0.2803 0.8490 221.0000 194.0000 172.0000 255.0000
0.1117 -0.2829 0.8500 225.0000 200.0000 178.0000 255.0000
You can remove the last column and row (as appears to be done in your question) with
>> pc = pc(1:end-1, 1:end-1)
pc =
0.1033 -0.2737 0.8570 221.0000 196.0000 174.0000
0.1054 -0.2731 0.8550 220.0000 195.0000 173.0000
...
0.1139 -0.2803 0.8490 221.0000 194.0000 172.0000