Clear Filters
Clear Filters

Selection and manipulation of a dataset

1 view (last 30 days)
Manduna Watson
Manduna Watson on 21 Jul 2014
Given the following data,
+ 0.5532 1 3 tcp 1500 ------- 0 0.0 3.0 56 135
- 0.553253 1 3 cbr 512 ------- 3 0.2 3.4 1 71
+ 0.554179 1 3 cbr 512 ------- 3 0.2 3.4 21 136
r 0.555253 1 3 cbr 512 ------- 3 0.2 3.4 0 68
+ 0.5558 1 3 cbr 500 ------- 2 2.1 3.2 9 138
- 0.555984 1 3 tcp 1500 ------- 0 0.0 3.0 42 73
+ 0.5608 1 3 cbr 500 ------- 2 2.1 3.2 10 140
+ 0.5612 1 3 tcp 1500 ------- 0 0.0 3.0 57 139
+ 0.562019 1 3 cbr 512 ------- 3 0.2 3.4 22 141
r 0.563253 1 3 tcp 1500 ------- 0 0.0 3.0 41 70
- 0.563984 1 3 cbr 512 ------- 3 0.2 3.4 2 74
+ 0.5658 1 3 cbr 500 ------- 2 2.1 3.2 11 143
r 0.565984 1 3 cbr 512 ------- 3 0.2 3.4 1 71
How can I, for example,
A: select and display data with + , 3 , and *tcp only * .
B: select and count data with + , 3 , tcp and 3.0 only.
Please note that the data to be analyzed is separated by space. The data has 12 columns whose headings are; Event , time , from_Node , to_Node , Packet_Type , Packet_Size , Flags , F id , Source_Address , Destination_Address , Sequence_Number and Packet_Id .
For example, + 0.155355 1 3 tcp 1500 ------- 0 0.0 3.0 2 3;
+ is an event ,
0.155355 is time in secs,
1 is from_Node ,
3 is to_Node ,
tcp is Packet_Type ,
1500 is Packet_Size ,
*-------* are *Flags* ,
0 is Fid ,
0.0 is Source_Address ,
3.0 is Destination_Address ,
2 is Sequence_Number and
3 is Packet_Id .
I have used = = to find and display rows with a specific number. e.g.
dsFS = dsNew2(dsNew2.VarName2==0.554179,:);
I have also used strfind, to find a certain char like ‘+’ as shown below
dsFS1 = strfind (S.VarName1,'+'); to display a char ‘+’.
alternatively, I have also used ismember and strcmpi , to find ‘+’, where S=data and S2=’+’ as shown below.
[Lia,Locb] = ismember(S, S2); stringcomp=strcmpi(S, S2); DisplayR=S(Lia,:);
As explained above, my challenge is to ; (A): select and display data with + , 3 , and tcp only .
(B): * select * and count data with + , 3 , tcp and 3.0 only

Answers (0)

Categories

Find more on Atomic, Molecular & Optical in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!