Prev: [Simmechanics] build spring damper mass system with nonlinear
Next: How to take off the double ytick in plotyy
From: Rachit on 24 May 2010 20:52 Hello All, I have some data in a file of which some comes under Log Peak-Valley Data whereas the other comes in Log Timed data. I want to read the data only from Log Peak-Valley data and ignore the one from Log Timed data and other paramters also as given below. I have got the code for extracting all the numbers but my problem is it comes frmo Log Peak-Valley data as well as from Log Timed data. Can anyone suggest me how to get rid of the Log Timed data ? I am using the code as shown below. I am not sure what string data I need to use while feof(fid) == 0 tline = fgetl(fid); line_tokens = regexp(tline, '\s+', 'split'); [rows columns] = size(line_tokens); if columns == 6 coordinates(x,1) = num2cell(str2double(line_tokens(1,1))); coordinates(x,2) = num2cell(str2double(line_tokens(1,2))); x = x + 1; end The File which I am using is as follows : Cyclic Acquisition Log Peak-Valley Data Time: 132.08301 Sec 3/16/2009 10:18:46 AM Stored at: 5 cycle Stored for: 10 segments Points: 5 Time Axial Displacement Axial Force 450 N Axial Count Rollover Running Time Axial Force 450 N Command Sec mm N segments Sec N 131.13281 -3.7543278 -147.42792 13 4.3417969 -123.11491 131.23535 -2.4447632 -89.850914 14 4.4443359 - Cyclic Acquisition Log Timed Data Time: 133.68652 Sec 3/16/2009 10:18:48 AM Stored at: 10 cycle Stored for: 10 segments Points: 103 Time Axial Displacement Axial Force 450 N Axial Count Rollover Running Time Axial Force 450 N Command Sec mm N segments Sec N 131.58594 -3.0023904 -118.79285 18 4.7949219 -40.373043 131.5957 -2.7235873 -107.47877 18 4.8046875 -43.690971
From: Walter Roberson on 24 May 2010 22:32 Rachit wrote: > I have some data in a file of which some comes under Log Peak-Valley > Data whereas the other comes in Log Timed data. I want to read the data > only from Log Peak-Valley data and ignore the one from Log Timed data > and other paramters also as given below. > > I have got the code for extracting all the numbers but my problem is it > comes frmo Log Peak-Valley data as well as from Log Timed data. > Can anyone suggest me how to get rid of the Log Timed data ? > > I am using the code as shown below. I am not sure what string data I > need to use > while feof(fid) == 0 > tline = fgetl(fid); > line_tokens = regexp(tline, '\s+', 'split'); > [rows columns] = size(line_tokens); > if columns == 6 > coordinates(x,1) = num2cell(str2double(line_tokens(1,1))); > coordinates(x,2) = num2cell(str2double(line_tokens(1,2))); > x = x + 1; end if strmatch('Log Timed', tline) while ischar(tline) & ~isempty(tline) tline = fgetl(fid); end end After which tline will be numeric if you hit end of file and will be the empty string otherwise.
From: Rachit on 25 May 2010 15:13
Thanks a lot!!! Walter Roberson <roberson(a)hushmail.com> wrote in message <5FGKn.29595$rE4.21140(a)newsfe15.iad>... > Rachit wrote: > > > I have some data in a file of which some comes under Log Peak-Valley > > Data whereas the other comes in Log Timed data. I want to read the data > > only from Log Peak-Valley data and ignore the one from Log Timed data > > and other paramters also as given below. > > > > I have got the code for extracting all the numbers but my problem is it > > comes frmo Log Peak-Valley data as well as from Log Timed data. > > Can anyone suggest me how to get rid of the Log Timed data ? > > > > I am using the code as shown below. I am not sure what string data I > > need to use > > while feof(fid) == 0 > > tline = fgetl(fid); > > line_tokens = regexp(tline, '\s+', 'split'); > > [rows columns] = size(line_tokens); > > if columns == 6 > > coordinates(x,1) = num2cell(str2double(line_tokens(1,1))); > > coordinates(x,2) = num2cell(str2double(line_tokens(1,2))); > > x = x + 1; end > > if strmatch('Log Timed', tline) > while ischar(tline) & ~isempty(tline) > tline = fgetl(fid); > end > end > > After which tline will be numeric if you hit end of file and will be the > empty string otherwise. |