string extraction from a table

조회 수: 7 (최근 30일)
galben
galben 2022년 10월 23일
댓글: galben 2022년 10월 25일
How can I extract data for the Brown?
I would appreciate some help, i have been stuck with this.
Age = [38;43;38;40;49;45;42;24;50;99];
Smoker = logical([1;0;1;0;1;1;1;0;0;1]);
LastName = {'Brown_Howard';'Johnson';'Lee';'Diaz';'Sanchez';'Brown_loewo';'Grace';'Brown_justin';'Peter';'Brown_002'};
Height = [71;69;64;67;64;67;66;55;45;88];
Weight = [176;163;131;133;100;136;153;131;133;149];
BloodPressure = [124 93; 19 77; 125 83; 117 75; 122 8;14 75; 135 23; 137 25; 142 30;42 30];
T = table(Age,Smoker,LastName, Weight,Height,BloodPressure)

채택된 답변

Paul
Paul 2022년 10월 23일
Age = [38;43;38;40;49;45;42;24;50;99];
Smoker = logical([1;0;1;0;1;1;1;0;0;1]);
LastName = {'Brown_Howard';'Johnson';'Lee';'Diaz';'Sanchez';'Brown_loewo';'Grace';'Brown_justin';'Peter';'Brown_002'};
Height = [71;69;64;67;64;67;66;55;45;88];
Weight = [176;163;131;133;100;136;153;131;133;149];
BloodPressure = [124 93; 19 77; 125 83; 117 75; 122 8;14 75; 135 23; 137 25; 142 30;42 30];
T = table(Age,Smoker,LastName, Weight,Height,BloodPressure)
T = 10×6 table
Age Smoker LastName Weight Height BloodPressure ___ ______ ________________ ______ ______ _____________ 38 true {'Brown_Howard'} 176 71 124 93 43 false {'Johnson' } 163 69 19 77 38 true {'Lee' } 131 64 125 83 40 false {'Diaz' } 133 67 117 75 49 true {'Sanchez' } 100 64 122 8 45 true {'Brown_loewo' } 136 67 14 75 42 true {'Grace' } 153 66 135 23 24 false {'Brown_justin'} 131 55 137 25 50 false {'Peter' } 133 45 142 30 99 true {'Brown_002' } 149 88 42 30
T(startsWith(T.LastName,'Brown'),:)
ans = 4×6 table
Age Smoker LastName Weight Height BloodPressure ___ ______ ________________ ______ ______ _____________ 38 true {'Brown_Howard'} 176 71 124 93 45 true {'Brown_loewo' } 136 67 14 75 24 false {'Brown_justin'} 131 55 137 25 99 true {'Brown_002' } 149 88 42 30

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by