table select rows with string/value of two colums
1 view (last 30 days)
Show older comments
Hi,
Following problem: I have a table with values for different categories (FKM, page), which is used to guide the further processing of the data. Since I only have 1 value for some categories and 2, 3, .. for others, the table cannot be evaluated with a for loop. How can I select rows based on a command like : Select all values that have value 113 in column FKM and L in page Can someone help me ? Here is an example from the table
___X______________Y___________________Z_________FKM____Seite_____________ObjArt_____________Var1__Var2....... 2222_________________________________
704306.281000000 5364346.78000000 440.678000000000 113 'R' 'AX_UnlandVegetationsloseFlaeche' 0 0 0 0 0 0
704128.356000000 5364559.83000000 442.202000000000 113 'L1' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
704102.320000000 5364597.45400000 441.863000000000 113 ' L2' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
703329.753000000 5363882.45200000 443.274000000000 114 ' L' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
703686.786000000 5363755.10600000 443.384000000000 114 'R' 'AX_Gehoelz' 0 0 0 0 0 0
702984.012000000 5363011.86700000 444.843000000000 115 'L' 'AX_UnlandVegetationsloseFlaeche' 0 0 0 0 0 0
703418.892000000 5362702.32900000 445.046000000000 115 'R' 'AX_Gehoelz' 0 0 0 0 0 0
702520.915000000 5362127.03000000 445.696000000000 116 'L1' 'AX_Wald' 0 0 0 0 0 0
702916.399000000 5361892.60400000 445.880000000000 116 'R1' 'AX_Wald' 0 0 0 0 0 0
702499.970000000 5362137.68000000 446.443000000000 116 'L2' 'AX_Landwirtschaft' 0 0 0 0 0 0
703151.189000000 5361748.81700000 446.536000000000 116 'R2' 'AX_Landwirtschaft' 0 0 0 0 0 0
702109.300000000 5361227.85000000 447.913000000000 117 'L1' 'AX_Wald' 0 0 0 0 0 0
Thanks
0 Comments
Answers (1)
Chunru
on 23 Jun 2022
Edited: Chunru
on 23 Jun 2022
data ={
704306.281000000 5364346.78000000 440.678000000000 113 'R' 'AX_UnlandVegetationsloseFlaeche' 0 0 0 0 0 0
704128.356000000 5364559.83000000 442.202000000000 113 'L1' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
704102.320000000 5364597.45400000 441.863000000000 113 ' L2' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
703329.753000000 5363882.45200000 443.274000000000 114 ' L' 'AX_SportFreizeitUndErholungsflaeche' 0 0 0 0 0 0
703686.786000000 5363755.10600000 443.384000000000 114 'R' 'AX_Gehoelz' 0 0 0 0 0 0
702984.012000000 5363011.86700000 444.843000000000 115 'L' 'AX_UnlandVegetationsloseFlaeche' 0 0 0 0 0 0
703418.892000000 5362702.32900000 445.046000000000 115 'R' 'AX_Gehoelz' 0 0 0 0 0 0
702520.915000000 5362127.03000000 445.696000000000 116 'L1' 'AX_Wald' 0 0 0 0 0 0
702916.399000000 5361892.60400000 445.880000000000 116 'R1' 'AX_Wald' 0 0 0 0 0 0
702499.970000000 5362137.68000000 446.443000000000 116 'L2' 'AX_Landwirtschaft' 0 0 0 0 0 0
703151.189000000 5361748.81700000 446.536000000000 116 'R2' 'AX_Landwirtschaft' 0 0 0 0 0 0
702109.300000000 5361227.85000000 447.913000000000 117 'L1' 'AX_Wald' 0 0 0 0 0 0
};
T = cell2table(data);
% How can I select rows based on a command like : Select all values that have value 113 in
% column FKM and L in page Can someone help me ? Here is an example from the table
T.data5 = strtrim(string(T.data5))
selected = T(T.data4 == 113 & T.data5=="L1", :) % use your column names if different
0 Comments
See Also
Categories
Find more on Physical Channels 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!