Hello,
I need to find where in a file a string occurs, and grab the 5th and 6th values on the same line into 2 variables. Here's a sample of the data:
401 FxTB 2591.1675 15.3213 2569.5085 2619.7012 50.1926 kN 20.840 s 4.080 s 522 103 402 FyTB 0.8813 17.3074 -67.7260 64.5470 132.2730 kN 15.280 s 16.560 s 383 415
I don't know where the FxTB will occur, but I need to store the 2569.5085 and 2619.7012 in two variables. I was using this:
fmt = ['%*f %*s' repmat('%*f',1,2) '%f %f']; % skip snb#/snbName/2numbers, then read 2 values: sensor 401
v = cell2mat(textscan(fid2,fmt,1,'headerlines', 553-1));
…but the line doesn't always occur on line number 553.
Maybe I need to load the whole file into memory…since I do search for about 6 variables per file.
Best Answer