table select rows with string/value of two colums

2 visualizzazioni (ultimi 30 giorni)
Frederik Reese
Frederik Reese il 23 Giu 2022
Modificato: Chunru il 23 Giu 2022
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

Risposte (1)

Chunru
Chunru il 23 Giu 2022
Modificato: Chunru il 23 Giu 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))
T = 12×12 table
data1 data2 data3 data4 data5 data6 data7 data8 data9 data10 data11 data12 __________ __________ ______ _____ _____ _______________________________________ _____ _____ _____ ______ ______ ______ 7.0431e+05 5.3643e+06 440.68 113 "R" {'AX_UnlandVegetationsloseFlaeche' } 0 0 0 0 0 0 7.0413e+05 5.3646e+06 442.2 113 "L1" {'AX_SportFreizeitUndErholungsflaeche'} 0 0 0 0 0 0 7.041e+05 5.3646e+06 441.86 113 "L2" {'AX_SportFreizeitUndErholungsflaeche'} 0 0 0 0 0 0 7.0333e+05 5.3639e+06 443.27 114 "L" {'AX_SportFreizeitUndErholungsflaeche'} 0 0 0 0 0 0 7.0369e+05 5.3638e+06 443.38 114 "R" {'AX_Gehoelz' } 0 0 0 0 0 0 7.0298e+05 5.363e+06 444.84 115 "L" {'AX_UnlandVegetationsloseFlaeche' } 0 0 0 0 0 0 7.0342e+05 5.3627e+06 445.05 115 "R" {'AX_Gehoelz' } 0 0 0 0 0 0 7.0252e+05 5.3621e+06 445.7 116 "L1" {'AX_Wald' } 0 0 0 0 0 0 7.0292e+05 5.3619e+06 445.88 116 "R1" {'AX_Wald' } 0 0 0 0 0 0 7.025e+05 5.3621e+06 446.44 116 "L2" {'AX_Landwirtschaft' } 0 0 0 0 0 0 7.0315e+05 5.3617e+06 446.54 116 "R2" {'AX_Landwirtschaft' } 0 0 0 0 0 0 7.0211e+05 5.3612e+06 447.91 117 "L1" {'AX_Wald' } 0 0 0 0 0 0
selected = T(T.data4 == 113 & T.data5=="L1", :) % use your column names if different
selected = 1×12 table
data1 data2 data3 data4 data5 data6 data7 data8 data9 data10 data11 data12 __________ __________ _____ _____ _____ _______________________________________ _____ _____ _____ ______ ______ ______ 7.0413e+05 5.3646e+06 442.2 113 "L1" {'AX_SportFreizeitUndErholungsflaeche'} 0 0 0 0 0 0

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by