Is it possible to use the "contains" function on a table in Excel? I keep getting the following: "Error using contains. First argument must be text."

5 views (last 30 days)
I keep getting the following: "Error using contains. First argument must be text." However, the cell I am referencing in the table is already text.
Goal of the code below is to grab every row that contains the phrases "Hurricane" or "Hurr" (for Set No. & Phase No. "1:1") and put it into a separate table.
data = importfile('Sample Data.xlsx');
data.resultant = sqrt((data.StructureLoadsVertlbs.^2 + data.StructureLoadsTranslbs.^2 + data.StructureLoadsLonglbs.^2));
SetNo=[1 3 9 9 9 10 10 10 45 46 49 49 49 50 50 50 51 51 51 52 52 52 53 54 57 58 59 60];
PhaseNo=[1 1 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 1 1 1 1];
chosenSetNo = 1;
chosenPhaseNo = 1;
idx = data.SetNo == chosenSetNo & data.PhaseNo == chosenPhaseNo;
data_1 = data(idx,:);
txt = ["Hurricane"; "Hurr"];
for ii=1:size(data_1,1);
x=data_1(ii,4);
if contains(x,txt)
Z_Hurr=data_1(ii,:);
end
end

Accepted Answer

Voss
Voss on 28 Jan 2022
I didn't have the function importdata() you're using to read the file, so I made a guess at what it does and adjusted the syntax accordingly. This reads the file and returns its contents as a table variable. You mention using tables in the question, so maybe this'll work.
data = readtable('Sample Data.xlsx','VariableNamingRule','preserve');
disp(data)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings _____ ____ ____ _______________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ 1 1 12 {'Hurricane NL+' } 1 1 {'S1A' } -63 -142 -4471 0 0 0 -63 -142 -4471 NaN 2 1 12 {'Hurricane NL+' } 3 1 {'S1B' } 125 -27 3507 125 -27 3507 0 0 0 NaN 3 1 12 {'Hurricane NL+' } 9 1 {'T1-A' } -212 -424 -14308 0 0 0 -212 -424 -14308 NaN 4 1 12 {'Hurricane NL+' } 9 2 {'T2-A' } -370 -439 -14300 0 0 0 -370 -439 -14300 NaN 5 1 12 {'Hurricane NL+' } 9 3 {'T3-A' } -528 -456 -14291 0 0 0 -528 -456 -14291 NaN 6 1 12 {'Hurricane NL+' } 10 1 {'T1-B' } 525 -178 13548 525 -178 13548 0 0 0 NaN 7 1 12 {'Hurricane NL+' } 10 2 {'T2-B' } 403 -199 13546 403 -199 13546 0 0 0 NaN 8 1 12 {'Hurricane NL+' } 10 3 {'T3-B' } 281 -222 13544 281 -222 13544 0 0 0 NaN 9 1 12 {'Hurricane NL+' } 45 1 {'F1a' } -50 104 -1168 0 0 0 -50 104 -1168 NaN 10 1 12 {'Hurricane NL+' } 46 1 {'F1b' } 13 134 1166 13 134 1166 0 0 0 NaN 11 1 12 {'Hurricane NL+' } 49 1 {'D11R' } 24 87 3699 24 87 3699 0 0 0 NaN 12 1 12 {'Hurricane NL+' } 49 2 {'D22E' } 24 85 3698 24 85 3698 0 0 0 NaN 13 1 12 {'Hurricane NL+' } 49 3 {'D33R' } 24 82 3698 24 82 3698 0 0 0 NaN 14 1 12 {'Hurricane NL+' } 50 1 {'D11L' } 23 121 3700 23 121 3700 0 0 0 NaN 15 1 12 {'Hurricane NL+' } 50 2 {'D22L' } 23 118 3700 23 118 3700 0 0 0 NaN 16 1 12 {'Hurricane NL+' } 50 3 {'D33L' } 23 114 3700 23 114 3700 0 0 0 NaN 17 1 12 {'Hurricane NL+' } 51 1 {'D1L' } -248 54 -4637 0 0 0 -248 54 -4637 NaN 18 1 12 {'Hurricane NL+' } 51 2 {'D2L' } -248 52 -4637 0 0 0 -248 52 -4637 NaN 19 1 12 {'Hurricane NL+' } 51 3 {'D3L' } -248 49 -4637 0 0 0 -248 49 -4637 NaN 20 1 12 {'Hurricane NL+' } 52 1 {'D1R' } -247 -14 -4632 0 0 0 -247 -14 -4632 NaN 21 1 12 {'Hurricane NL+' } 52 2 {'D2E' } -247 -16 -4632 0 0 0 -247 -16 -4632 NaN 22 1 12 {'Hurricane NL+' } 52 3 {'D3R' } -247 -18 -4632 0 0 0 -247 -18 -4632 NaN 23 1 12 {'Hurricane NL+' } 53 1 {'n1' } -79 79 654 0 39 2286 -79 40 -1631 NaN 24 1 12 {'Hurricane NL+' } 54 1 {'n2' } -79 107 652 0 50 2286 -79 57 -1634 NaN 25 1 12 {'Hurricane NL+' } 57 1 {'Pole:CMM1'} -120 339 23 0 196 2311 -121 143 -2287 NaN 26 1 12 {'Hurricane NL+' } 58 1 {'Pole:CMM2'} -120 339 25 0 196 2311 -121 143 -2285 NaN 27 1 12 {'Hurricane NL+' } 59 1 {'Pole:CMM3'} -120 339 28 0 196 2311 -121 143 -2283 NaN 28 1 12 {'Hurricane NL+' } 60 1 {'Pole:CMM4'} -120 339 31 0 196 2311 -120 143 -2280 NaN 29 2 12 {'Hurricane NL-' } 1 1 {'S1A' } -63 -483 -4447 0 0 0 -63 -483 -4447 NaN 30 2 12 {'Hurricane NL-' } 3 1 {'S1B' } 125 -438 3480 125 -438 3480 0 0 0 NaN 31 2 12 {'Hurricane NL-' } 9 1 {'T1-A' } -212 -1820 -14219 0 0 0 -212 -1820 -14219 NaN 32 2 12 {'Hurricane NL-' } 9 2 {'T2-A' } -370 -1812 -14213 0 0 0 -370 -1812 -14213 NaN 33 2 12 {'Hurricane NL-' } 9 3 {'T3-A' } -528 -1803 -14205 0 0 0 -528 -1803 -14205 NaN 34 2 12 {'Hurricane NL-' } 10 1 {'T1-B' } 525 -1811 13447 525 -1811 13447 0 0 0 NaN 35 2 12 {'Hurricane NL-' } 10 2 {'T2-B' } 403 -1800 13447 403 -1800 13447 0 0 0 NaN 36 2 12 {'Hurricane NL-' } 10 3 {'T3-B' } 281 -1788 13447 281 -1788 13447 0 0 0 NaN 37 2 12 {'Hurricane NL-' } 45 1 {'F1a' } -50 -231 -1152 0 0 0 -50 -231 -1152 NaN 38 2 12 {'Hurricane NL-' } 46 1 {'F1b' } 13 -260 1146 13 -260 1146 0 0 0 NaN 39 2 12 {'Hurricane NL-' } 49 1 {'D11R' } 24 -476 3672 24 -476 3672 0 0 0 NaN 40 2 12 {'Hurricane NL-' } 49 2 {'D22E' } 24 -473 3672 24 -473 3672 0 0 0 NaN 41 2 12 {'Hurricane NL-' } 49 3 {'D33R' } 24 -469 3673 24 -469 3673 0 0 0 NaN 42 2 12 {'Hurricane NL-' } 50 1 {'D11L' } 23 -441 3679 23 -441 3679 0 0 0 NaN 43 2 12 {'Hurricane NL-' } 50 2 {'D22L' } 23 -438 3679 23 -438 3679 0 0 0 NaN 44 2 12 {'Hurricane NL-' } 50 3 {'D33L' } 23 -435 3679 23 -435 3679 0 0 0 NaN 45 2 12 {'Hurricane NL-' } 51 1 {'D1L' } -248 -430 -4620 0 0 0 -248 -430 -4620 NaN 46 2 12 {'Hurricane NL-' } 51 2 {'D2L' } -248 -428 -4620 0 0 0 -248 -428 -4620 NaN 47 2 12 {'Hurricane NL-' } 51 3 {'D3L' } -248 -427 -4620 0 0 0 -248 -427 -4620 NaN 48 2 12 {'Hurricane NL-' } 52 1 {'D1R' } -247 -498 -4609 0 0 0 -247 -498 -4609 NaN 49 2 12 {'Hurricane NL-' } 52 2 {'D2E' } -247 -495 -4609 0 0 0 -247 -495 -4609 NaN 50 2 12 {'Hurricane NL-' } 52 3 {'D3R' } -247 -493 -4609 0 0 0 -247 -493 -4609 NaN 51 2 12 {'Hurricane NL-' } 53 1 {'n1' } -79 -480 653 0 -267 2271 -79 -213 -1618 NaN 52 2 12 {'Hurricane NL-' } 54 1 {'n2' } -79 -451 649 0 -255 2272 -79 -196 -1623 NaN 53 2 12 {'Hurricane NL-' } 57 1 {'Pole:CMM1'} -120 -778 18 0 -416 2281 -121 -362 -2263 NaN 54 2 12 {'Hurricane NL-' } 58 1 {'Pole:CMM2'} -120 -778 20 0 -416 2281 -121 -361 -2261 NaN 55 2 12 {'Hurricane NL-' } 59 1 {'Pole:CMM3'} -120 -777 23 0 -416 2281 -121 -361 -2258 NaN 56 2 12 {'Hurricane NL-' } 60 1 {'Pole:CMM4'} -120 -777 26 0 -416 2281 -120 -361 -2256 NaN 57 3 12 {'Hurricane NR+' } 1 1 {'S1A' } -63 -141 -4488 0 0 0 -63 -141 -4488 NaN 58 3 12 {'Hurricane NR+' } 3 1 {'S1B' } 125 -28 3488 125 -28 3488 0 0 0 NaN 59 3 12 {'Hurricane NR+' } 9 1 {'T1-A' } -215 -421 -14375 0 0 0 -215 -421 -14375 NaN 60 3 12 {'Hurricane NR+' } 9 2 {'T2-A' } -374 -436 -14367 0 0 0 -374 -436 -14367 NaN 61 3 12 {'Hurricane NR+' } 9 3 {'T3-A' } -532 -453 -14358 0 0 0 -532 -453 -14358 NaN 62 3 12 {'Hurricane NR+' } 10 1 {'T1-B' } 525 -182 13469 525 -182 13469 0 0 0 NaN 63 3 12 {'Hurricane NR+' } 10 2 {'T2-B' } 403 -203 13467 403 -203 13467 0 0 0 NaN 64 3 12 {'Hurricane NR+' } 10 3 {'T3-B' } 282 -225 13465 282 -225 13465 0 0 0 NaN 65 3 12 {'Hurricane NR+' } 45 1 {'F1a' } -51 105 -1178 0 0 0 -51 105 -1178 NaN 66 3 12 {'Hurricane NR+' } 46 1 {'F1b' } 14 132 1156 14 132 1156 0 0 0 NaN 67 3 12 {'Hurricane NR+' } 49 1 {'D11R' } 24 86 3677 24 86 3677 0 0 0 NaN 68 3 12 {'Hurricane NR+' } 49 2 {'D22E' } 24 83 3677 24 83 3677 0 0 0 NaN 69 3 12 {'Hurricane NR+' } 49 3 {'D33R' } 24 81 3677 24 81 3677 0 0 0 NaN 70 3 12 {'Hurricane NR+' } 50 1 {'D11L' } 24 120 3685 24 120 3685 0 0 0 NaN 71 3 12 {'Hurricane NR+' } 50 2 {'D22L' } 24 116 3684 24 116 3684 0 0 0 NaN 72 3 12 {'Hurricane NR+' } 50 3 {'D33L' } 24 113 3684 24 113 3684 0 0 0 NaN 73 3 12 {'Hurricane NR+' } 51 1 {'D1L' } -249 55 -4652 0 0 0 -249 55 -4652 NaN 74 3 12 {'Hurricane NR+' } 51 2 {'D2L' } -249 53 -4652 0 0 0 -249 53 -4652 NaN 75 3 12 {'Hurricane NR+' } 51 3 {'D3L' } -249 50 -4652 0 0 0 -249 50 -4652 NaN 76 3 12 {'Hurricane NR+' } 52 1 {'D1R' } -248 -13 -4652 0 0 0 -248 -13 -4652 NaN 77 3 12 {'Hurricane NR+' } 52 2 {'D2E' } -248 -15 -4652 0 0 0 -248 -15 -4652 NaN 78 3 12 {'Hurricane NR+' } 52 3 {'D3R' } -248 -17 -4652 0 0 0 -248 -17 -4652 NaN 79 3 12 {'Hurricane NR+' } 53 1 {'n1' } -79 78 630 1 38 2274 -80 40 -1644 NaN 80 3 12 {'Hurricane NR+' } 54 1 {'n2' } -80 107 632 0 49 2275 -80 58 -1643 NaN 81 3 12 {'Hurricane NR+' } 57 1 {'Pole:CMM1'} -121 338 -10 1 194 2294 -122 145 -2304 NaN 82 3 12 {'Hurricane NR+' } 58 1 {'Pole:CMM2'} -121 338 -7 1 194 2294 -122 145 -2301 NaN 83 3 12 {'Hurricane NR+' } 59 1 {'Pole:CMM3'} -121 339 -4 1 194 2294 -122 145 -2299 NaN 84 3 12 {'Hurricane NR+' } 60 1 {'Pole:CMM4'} -121 339 -2 1 194 2294 -121 145 -2296 NaN 85 4 12 {'Hurricane NR-' } 1 1 {'S1A' } -63 -486 -4464 0 0 0 -63 -486 -4464 NaN 86 4 12 {'Hurricane NR-' } 3 1 {'S1B' } 125 -434 3461 125 -434 3461 0 0 0 NaN 87 4 12 {'Hurricane NR-' } 9 1 {'T1-A' } -215 -1834 -14285 0 0 0 -215 -1834 -14285 NaN 88 4 12 {'Hurricane NR-' } 9 2 {'T2-A' } -374 -1826 -14278 0 0 0 -374 -1826 -14278 NaN 89 4 12 {'Hurricane NR-' } 9 3 {'T3-A' } -532 -1817 -14270 0 0 0 -532 -1817 -14270 NaN 90 4 12 {'Hurricane NR-' } 10 1 {'T1-B' } 525 -1795 13369 525 -1795 13369 0 0 0 NaN 91 4 12 {'Hurricane NR-' } 10 2 {'T2-B' } 403 -1785 13370 403 -1785 13370 0 0 0 NaN 92 4 12 {'Hurricane NR-' } 10 3 {'T3-B' } 282 -1773 13369 282 -1773 13369 0 0 0 NaN 93 4 12 {'Hurricane NR-' } 45 1 {'F1a' } -51 -233 -1161 0 0 0 -51 -233 -1161 NaN 94 4 12 {'Hurricane NR-' } 46 1 {'F1b' } 14 -258 1137 14 -258 1137 0 0 0 NaN 95 4 12 {'Hurricane NR-' } 49 1 {'D11R' } 24 -472 3651 24 -472 3651 0 0 0 NaN 96 4 12 {'Hurricane NR-' } 49 2 {'D22E' } 24 -469 3651 24 -469 3651 0 0 0 NaN 97 4 12 {'Hurricane NR-' } 49 3 {'D33R' } 24 -465 3652 24 -465 3652 0 0 0 NaN 98 4 12 {'Hurricane NR-' } 50 1 {'D11L' } 24 -438 3663 24 -438 3663 0 0 0 NaN 99 4 12 {'Hurricane NR-' } 50 2 {'D22L' } 24 -435 3663 24 -435 3663 0 0 0 NaN 100 4 12 {'Hurricane NR-' } 50 3 {'D33L' } 24 -433 3663 24 -433 3663 0 0 0 NaN 101 4 12 {'Hurricane NR-' } 51 1 {'D1L' } -249 -433 -4635 0 0 0 -249 -433 -4635 NaN 102 4 12 {'Hurricane NR-' } 51 2 {'D2L' } -249 -431 -4635 0 0 0 -249 -431 -4635 NaN 103 4 12 {'Hurricane NR-' } 51 3 {'D3L' } -249 -429 -4635 0 0 0 -249 -429 -4635 NaN 104 4 12 {'Hurricane NR-' } 52 1 {'D1R' } -248 -501 -4628 0 0 0 -248 -501 -4628 NaN 105 4 12 {'Hurricane NR-' } 52 2 {'D2E' } -248 -498 -4628 0 0 0 -248 -498 -4628 NaN 106 4 12 {'Hurricane NR-' } 52 3 {'D3R' } -248 -496 -4629 0 0 0 -248 -496 -4629 NaN 107 4 12 {'Hurricane NR-' } 53 1 {'n1' } -79 -480 629 1 -265 2259 -80 -215 -1630 NaN 108 4 12 {'Hurricane NR-' } 54 1 {'n2' } -80 -451 629 0 -254 2261 -80 -197 -1632 NaN 109 4 12 {'Hurricane NR-' } 57 1 {'Pole:CMM1'} -121 -777 -14 1 -413 2265 -122 -365 -2279 NaN 110 4 12 {'Hurricane NR-' } 58 1 {'Pole:CMM2'} -121 -777 -12 1 -413 2265 -122 -365 -2277 NaN 111 4 12 {'Hurricane NR-' } 59 1 {'Pole:CMM3'} -121 -777 -9 1 -413 2265 -122 -364 -2274 NaN 112 4 12 {'Hurricane NR-' } 60 1 {'Pole:CMM4'} -121 -777 -6 1 -413 2265 -121 -364 -2272 NaN 113 5 12 {'Hurricane BI+' } 1 1 {'S1A' } -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 114 5 12 {'Hurricane BI+' } 3 1 {'S1B' } 125 -28 3501 125 -28 3501 0 0 0 NaN 115 5 12 {'Hurricane BI+' } 9 1 {'T1-A' } -213 -421 -14347 0 0 0 -213 -421 -14347 NaN 116 5 12 {'Hurricane BI+' } 9 2 {'T2-A' } -372 -437 -14339 0 0 0 -372 -437 -14339 NaN 117 5 12 {'Hurricane BI+' } 9 3 {'T3-A' } -531 -453 -14329 0 0 0 -531 -453 -14329 NaN 118 5 12 {'Hurricane BI+' } 10 1 {'T1-B' } 525 -179 13518 525 -179 13518 0 0 0 NaN 119 5 12 {'Hurricane BI+' } 10 2 {'T2-B' } 403 -200 13517 403 -200 13517 0 0 0 NaN 120 5 12 {'Hurricane BI+' } 10 3 {'T3-B' } 281 -222 13514 281 -222 13514 0 0 0 NaN 121 5 12 {'Hurricane BI+' } 45 1 {'F1a' } -51 105 -1175 0 0 0 -51 105 -1175 NaN 122 5 12 {'Hurricane BI+' } 46 1 {'F1b' } 14 133 1163 14 133 1163 0 0 0 NaN 123 5 12 {'Hurricane BI+' } 49 1 {'D11R' } 24 87 3693 24 87 3693 0 0 0 NaN 124 5 12 {'Hurricane BI+' } 49 2 {'D22E' } 24 85 3693 24 85 3693 0 0 0 NaN 125 5 12 {'Hurricane BI+' } 49 3 {'D33R' } 24 82 3693 24 82 3693 0 0 0 NaN 126 5 12 {'Hurricane BI+' } 50 1 {'D11L' } 23 121 3698 23 121 3698 0 0 0 NaN 127 5 12 {'Hurricane BI+' } 50 2 {'D22L' } 23 117 3698 23 117 3698 0 0 0 NaN 128 5 12 {'Hurricane BI+' } 50 3 {'D33L' } 23 114 3698 23 114 3698 0 0 0 NaN 129 5 12 {'Hurricane BI+' } 51 1 {'D1L' } -249 55 -4649 0 0 0 -249 55 -4649 NaN 130 5 12 {'Hurricane BI+' } 51 2 {'D2L' } -249 52 -4649 0 0 0 -249 52 -4649 NaN 131 5 12 {'Hurricane BI+' } 51 3 {'D3L' } -249 50 -4649 0 0 0 -249 50 -4649 NaN 132 5 12 {'Hurricane BI+' } 52 1 {'D1R' } -248 -13 -4647 0 0 0 -248 -13 -4647 NaN 133 5 12 {'Hurricane BI+' } 52 2 {'D2E' } -248 -15 -4647 0 0 0 -248 -15 -4647 NaN 134 5 12 {'Hurricane BI+' } 52 3 {'D3R' } -248 -17 -4647 0 0 0 -248 -17 -4647 NaN 135 5 12 {'Hurricane BI+' } 53 1 {'n1' } -79 79 643 0 39 2283 -80 40 -1640 NaN 136 5 12 {'Hurricane BI+' } 54 1 {'n2' } -79 108 642 0 50 2283 -80 58 -1641 NaN 137 5 12 {'Hurricane BI+' } 57 1 {'Pole:CMM1'} -121 339 7 0 195 2306 -122 144 -2300 NaN 138 5 12 {'Hurricane BI+' } 58 1 {'Pole:CMM2'} -121 340 9 0 195 2306 -121 144 -2297 NaN 139 5 12 {'Hurricane BI+' } 59 1 ...
disp(data.Properties.VariableNames.')
{'Row #' } {'LC #' } {'WC #' } {'Load Case Description' } {'Set No.' } {'Phase No.' } {'Attach. Joint Labels' } {'Structure Loads Vert. (lbs)' } {'Structure Loads Trans. (lbs)' } {'Structure Loads Long. (lbs)' } {'Loads from back span Vert. (lbs)' } {'Loads from back span Trans. (lbs)' } {'Loads from back span Long. (lbs)' } {'Loads from ahead span Vert. (lbs)' } {'Loads from ahead span Trans. (lbs)'} {'Loads from ahead span Long. (lbs)' } {'Warnings' }
data.resultant = sqrt(data.('Structure Loads Vert. (lbs)').^2 + data.('Structure Loads Trans. (lbs)').^2 + data.('Structure Loads Long. (lbs)').^2);
SetNo=[1 3 9 9 9 10 10 10 45 46 49 49 49 50 50 50 51 51 51 52 52 52 53 54 57 58 59 60];
PhaseNo=[1 1 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 1 1 1 1];
chosenSetNo = 1;
chosenPhaseNo = 1;
idx = data.('Set No.') == chosenSetNo & data.('Phase No.') == chosenPhaseNo;
data_1 = data(idx,:);
disp(data_1)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings resultant _____ ____ ____ _______________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ _________ 1 1 12 {'Hurricane NL+' } 1 1 {'S1A'} -63 -142 -4471 0 0 0 -63 -142 -4471 NaN 4473.7 29 2 12 {'Hurricane NL-' } 1 1 {'S1A'} -63 -483 -4447 0 0 0 -63 -483 -4447 NaN 4473.6 57 3 12 {'Hurricane NR+' } 1 1 {'S1A'} -63 -141 -4488 0 0 0 -63 -141 -4488 NaN 4490.7 85 4 12 {'Hurricane NR-' } 1 1 {'S1A'} -63 -486 -4464 0 0 0 -63 -486 -4464 NaN 4490.8 113 5 12 {'Hurricane BI+' } 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 141 6 12 {'Hurricane BI-' } 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 169 7 13 {'NESC 250B NL+' } 1 1 {'S1A'} -75 -306 -6166 0 0 0 -75 -306 -6166 NaN 6174 197 8 13 {'NESC 250B NL-' } 1 1 {'S1A'} -75 -556 -6148 0 0 0 -75 -556 -6148 NaN 6173.5 225 9 13 {'NESC 250B NR+' } 1 1 {'S1A'} -75 -305 -6166 0 0 0 -75 -305 -6166 NaN 6174 253 10 13 {'NESC 250B NR-' } 1 1 {'S1A'} -75 -558 -6148 0 0 0 -75 -558 -6148 NaN 6173.7 281 11 13 {'NESC 250B BI+' } 1 1 {'S1A'} -75 -305 -6166 0 0 0 -75 -305 -6166 NaN 6174 309 12 13 {'NESC 250B BI-' } 1 1 {'S1A'} -75 -557 -6148 0 0 0 -75 -557 -6148 NaN 6173.6 337 13 16 {'Rule 250D NL+' } 1 1 {'S1A'} 2 -267 -4272 0 0 0 2 -267 -4272 NaN 4280.3 365 14 16 {'Rule 250D NL-' } 1 1 {'S1A'} 2 -331 -4267 0 0 0 2 -331 -4267 NaN 4279.8 393 15 16 {'Rule 250D NR+' } 1 1 {'S1A'} 2 -266 -4272 0 0 0 2 -266 -4272 NaN 4280.3 421 16 16 {'Rule 250D NR-' } 1 1 {'S1A'} 2 -332 -4267 0 0 0 2 -332 -4267 NaN 4279.9 449 17 16 {'Rule 250D BI+' } 1 1 {'S1A'} 2 -266 -4272 0 0 0 2 -266 -4272 NaN 4280.3 477 18 16 {'Rule 250D BI-' } 1 1 {'S1A'} 2 -332 -4267 0 0 0 2 -332 -4267 NaN 4279.9 505 19 13 {'NESC Insul NA+' } 1 1 {'S1A'} -50 -211 -3735 0 0 0 -50 -211 -3735 NaN 3741.3 533 20 13 {'NESC Insul NA-' } 1 1 {'S1A'} -50 -312 -3728 0 0 0 -50 -312 -3728 NaN 3741.4 561 21 12 {'RULE 250C Insul NA+'} 1 1 {'S1A'} -57 -104 -3743 0 0 0 -57 -104 -3743 NaN 3744.9 589 22 12 {'RULE 250C Insul NA-'} 1 1 {'S1A'} -57 -418 -3721 0 0 0 -57 -418 -3721 NaN 3744.8 617 23 16 {'RULE 250D Insul NA+'} 1 1 {'S1A'} 2 -266 -4272 0 0 0 2 -266 -4272 NaN 4280.3 645 24 16 {'RULE 250D Insul NA-'} 1 1 {'S1A'} 2 -332 -4267 0 0 0 2 -332 -4267 NaN 4279.9 673 25 29 {'MIN TEMP' } 1 1 {'S1A'} -73 -300 -4286 0 0 0 -73 -300 -4286 NaN 4297.1 701 28 12 {'Hurr -90' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9 729 29 12 {'Hurr -85' } 1 1 {'S1A'} -41 -247 -3586 0 0 0 -41 -247 -3586 NaN 3594.7 757 30 12 {'Hurr -80' } 1 1 {'S1A'} -41 -241 -3591 0 0 0 -41 -241 -3591 NaN 3599.3 785 31 12 {'Hurr -75' } 1 1 {'S1A'} -41 -233 -3600 0 0 0 -41 -233 -3600 NaN 3607.8 813 32 12 {'Hurr -70' } 1 1 {'S1A'} -42 -225 -3622 0 0 0 -42 -225 -3622 NaN 3629.2 841 33 12 {'Hurr -65' } 1 1 {'S1A'} -43 -215 -3662 0 0 0 -43 -215 -3662 NaN 3668.6 869 34 12 {'Hurr -60' } 1 1 {'S1A'} -44 -206 -3714 0 0 0 -44 -206 -3714 NaN 3720 897 35 12 {'Hurr -55' } 1 1 {'S1A'} -46 -196 -3785 0 0 0 -46 -196 -3785 NaN 3790.4 925 36 12 {'Hurr -50' } 1 1 {'S1A'} -48 -187 -3868 0 0 0 -48 -187 -3868 NaN 3872.8 953 37 12 {'Hurr -45' } 1 1 {'S1A'} -50 -178 -3960 0 0 0 -50 -178 -3960 NaN 3964.3 981 38 12 {'Hurr -40' } 1 1 {'S1A'} -53 -170 -4056 0 0 0 -53 -170 -4056 NaN 4059.9 1009 39 12 {'Hurr -35' } 1 1 {'S1A'} -55 -163 -4152 0 0 0 -55 -163 -4152 NaN 4155.6 1037 40 12 {'Hurr -30' } 1 1 {'S1A'} -57 -157 -4244 0 0 0 -57 -157 -4244 NaN 4247.3 1065 41 12 {'Hurr -25' } 1 1 {'S1A'} -59 -152 -4327 0 0 0 -59 -152 -4327 NaN 4330.1 1093 42 12 {'Hurr -20' } 1 1 {'S1A'} -61 -147 -4392 0 0 0 -61 -147 -4392 NaN 4394.9 1121 43 12 {'Hurr -15' } 1 1 {'S1A'} -62 -144 -4445 0 0 0 -62 -144 -4445 NaN 4447.8 1149 44 12 {'Hurr -10' } 1 1 {'S1A'} -63 -142 -4475 0 0 0 -63 -142 -4475 NaN 4477.7 1177 45 12 {'Hurr -5' } 1 1 {'S1A'} -63 -141 -4490 0 0 0 -63 -141 -4490 NaN 4492.7 1205 46 12 {'Hurr 0' } 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 1233 47 12 {'Hurr 5' } 1 1 {'S1A'} -62 -143 -4458 0 0 0 -62 -143 -4458 NaN 4460.7 1261 48 12 {'Hurr 10' } 1 1 {'S1A'} -61 -146 -4414 0 0 0 -61 -146 -4414 NaN 4416.8 1289 49 12 {'Hurr 15' } 1 1 {'S1A'} -60 -150 -4353 0 0 0 -60 -150 -4353 NaN 4356 1317 50 12 {'Hurr 20' } 1 1 {'S1A'} -58 -155 -4279 0 0 0 -58 -155 -4279 NaN 4282.2 1345 51 12 {'Hurr 25' } 1 1 {'S1A'} -56 -161 -4192 0 0 0 -56 -161 -4192 NaN 4195.5 1373 52 12 {'Hurr 30' } 1 1 {'S1A'} -53 -167 -4095 0 0 0 -53 -167 -4095 NaN 4098.7 1401 53 12 {'Hurr 35' } 1 1 {'S1A'} -51 -175 -3999 0 0 0 -51 -175 -3999 NaN 4003.2 1429 54 12 {'Hurr 40' } 1 1 {'S1A'} -49 -183 -3903 0 0 0 -49 -183 -3903 NaN 3907.6 1457 55 12 {'Hurr 45' } 1 1 {'S1A'} -47 -192 -3815 0 0 0 -47 -192 -3815 NaN 3820.1 1485 56 12 {'Hurr 50' } 1 1 {'S1A'} -45 -202 -3741 0 0 0 -45 -202 -3741 NaN 3746.7 1513 57 12 {'Hurr 55' } 1 1 {'S1A'} -43 -211 -3679 0 0 0 -43 -211 -3679 NaN 3685.3 1541 58 12 {'Hurr 60' } 1 1 {'S1A'} -42 -221 -3635 0 0 0 -42 -221 -3635 NaN 3642 1569 59 12 {'Hurr 65' } 1 1 {'S1A'} -41 -230 -3609 0 0 0 -41 -230 -3609 NaN 3616.6 1597 60 12 {'Hurr 70' } 1 1 {'S1A'} -41 -238 -3591 0 0 0 -41 -238 -3591 NaN 3599.1 1625 61 12 {'Hurr 75' } 1 1 {'S1A'} -41 -244 -3586 0 0 0 -41 -244 -3586 NaN 3594.5 1653 62 12 {'Hurr 80' } 1 1 {'S1A'} -41 -249 -3586 0 0 0 -41 -249 -3586 NaN 3594.9 1681 63 12 {'Hurr 85' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 1709 64 12 {'Hurr 90' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1737 65 12 {'Hurr -90M' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1765 66 12 {'Hurr -85M' } 1 1 {'S1A'} -41 -255 -3585 0 0 0 -41 -255 -3585 NaN 3594.3 1793 67 12 {'Hurr -80M' } 1 1 {'S1A'} -41 -262 -3589 0 0 0 -41 -262 -3589 NaN 3598.8 1821 68 12 {'Hurr -75M' } 1 1 {'S1A'} -41 -271 -3597 0 0 0 -41 -271 -3597 NaN 3607.4 1849 69 12 {'Hurr -70M' } 1 1 {'S1A'} -42 -282 -3618 0 0 0 -42 -282 -3618 NaN 3629.2 1877 70 12 {'Hurr -65M' } 1 1 {'S1A'} -43 -297 -3656 0 0 0 -43 -297 -3656 NaN 3668.3 1905 71 12 {'Hurr -60M' } 1 1 {'S1A'} -44 -314 -3707 0 0 0 -44 -314 -3707 NaN 3720.5 1933 72 12 {'Hurr -55M' } 1 1 {'S1A'} -46 -333 -3775 0 0 0 -46 -333 -3775 NaN 3789.9 1961 73 12 {'Hurr -50M' } 1 1 {'S1A'} -48 -354 -3856 0 0 0 -48 -354 -3856 NaN 3872.5 1989 74 12 {'Hurr -45M' } 1 1 {'S1A'} -50 -376 -3946 0 0 0 -50 -376 -3946 NaN 3964.2 2017 75 12 {'Hurr -40M' } 1 1 {'S1A'} -53 -397 -4040 0 0 0 -53 -397 -4040 NaN 4059.8 2045 76 12 {'Hurr -35M' } 1 1 {'S1A'} -55 -417 -4135 0 0 0 -55 -417 -4135 NaN 4156.3 2073 77 12 {'Hurr -30M' } 1 1 {'S1A'} -57 -436 -4225 0 0 0 -57 -436 -4225 NaN 4247.8 2101 78 12 {'Hurr -25M' } 1 1 {'S1A'} -59 -453 -4306 0 0 0 -59 -453 -4306 NaN 4330.2 2129 79 12 {'Hurr -20M' } 1 1 {'S1A'} -61 -466 -4370 0 0 0 -61 -466 -4370 NaN 4395.2 2157 80 12 {'Hurr -15M' } 1 1 {'S1A'} -62 -477 -4421 0 0 0 -62 -477 -4421 NaN 4447.1 2185 81 12 {'Hurr -10M' } 1 1 {'S1A'} -63 -483 -4451 0 0 0 -63 -483 -4451 NaN 4477.6 2213 82 12 {'Hurr -5M' } 1 1 {'S1A'} -63 -486 -4466 0 0 0 -63 -486 -4466 NaN 4492.8 2241 83 12 {'Hurr 0M' } 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 2269 84 12 {'Hurr 5M' } 1 1 {'S1A'} -62 -480 -4434 0 0 0 -62 -480 -4434 NaN 4460.3 2297 85 12 {'Hurr 10M' } 1 1 {'S1A'} -61 -471 -4392 0 0 0 -61 -471 -4392 NaN 4417.6 2325 86 12 {'Hurr 15M' } 1 1 {'S1A'} -60 -459 -4332 0 0 0 -60 -459 -4332 NaN 4356.7 2353 87 12 {'Hurr 20M' } 1 1 {'S1A'} -58 -443 -4259 0 0 0 -58 -443 -4259 NaN 4282.4 2381 88 12 {'Hurr 25M' } 1 1 {'S1A'} -56 -425 -4173 0 0 0 -56 -425 -4173 NaN 4195 2409 89 12 {'Hurr 30M' } 1 1 {'S1A'} -53 -405 -4079 0 0 0 -53 -405 -4079 NaN 4099.4 2437 90 12 {'Hurr 35M' } 1 1 {'S1A'} -51 -384 -3985 0 0 0 -51 -384 -3985 NaN 4003.8 2465 91 12 {'Hurr 40M' } 1 1 {'S1A'} -49 -363 -3891 0 0 0 -49 -363 -3891 NaN 3908.2 2493 92 12 {'Hurr 45M' } 1 1 {'S1A'} -47 -342 -3805 0 0 0 -47 -342 -3805 NaN 3820.6 2521 93 12 {'Hurr 50M' } 1 1 {'S1A'} -45 -322 -3732 0 0 0 -45 -322 -3732 NaN 3746.1 2549 94 12 {'Hurr 55M' } 1 1 {'S1A'} -43 -304 -3673 0 0 0 -43 -304 -3673 NaN 3685.8 2577 95 12 {'Hurr 60M' } 1 1 {'S1A'} -42 -288 -3631 0 0 0 -42 -288 -3631 NaN 3642.6 2605 96 12 {'Hurr 65M' } 1 1 {'S1A'} -41 -275 -3605 0 0 0 -41 -275 -3605 NaN 3615.7 2633 97 12 {'Hurr 70M' } 1 1 {'S1A'} -41 -265 -3589 0 0 0 -41 -265 -3589 NaN 3599 2661 98 12 {'Hurr 75M' } 1 1 {'S1A'} -41 -258 -3585 0 0 0 -41 -258 -3585 NaN 3594.5 2689 99 12 {'Hurr 80M' } 1 1 {'S1A'} -41 -253 -3585 0 0 0 -41 -253 -3585 NaN 3594.2 2717 100 12 {'Hurr 85M' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 2745 101 12 {'Hurr 90M' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9 2790 103 13 {'NESC 250B NL-, DE' } 1 1 {'S1A'} -75 -556 -6148 0 0 0 -75 -556 -6148 NaN 6173.5 2824 105 13 {'NESC 250B NR-,DE' } 1 1 {'S1A'} -75 -558 -6148 0 0 0 -75 -558 -6148 NaN 6173.7 2858 107 13 {'NESC 250B BI-, DE' } 1 1 {'S1A'} -75 -557 -6148 0 0 0 -75 -557 -6148 NaN 6173.6 2892 109 16 {'Rule 250D BI-, DE' } 1 1 {'S1A'} 2 -332 -4267 0 0 0 2 -332 -4267 NaN 4279.9 2926 111 16 {'Rule 250D NL-, DE' } 1 1 {'S1A'} 2 -331 -4267 0 0 0 2 -331 -4267 NaN 4279.8 2960 113 16 {'Rule 250D NR-, DE' } 1 1 {'S1A'} 2 -332 -4267 0 0 0 2 -332 -4267 NaN 4279.9 2977 125 6 {'2% Deflection' } 1 1 {'S1A'} -28 -185 -2638 0 0 0 -28 -185 -2638 NaN 2644.6 3005 126 6 {'Normal Everyday' } 1 1 {'S1A'} -37 -209 -2988 0 0 0 -37 -209 -2988 NaN 2995.5
Note that data_1 is a sub-table of data. Similarly, data_1(ii,4) is a sub-table of data_1 (containing one cell). Use the syntax "data_1{ii,4}" to refer to the contents of that cell.
txt = ["Hurricane"; "Hurr"];
for ii=1:size(data_1,1);
x=data_1{ii,4};
if contains(x,txt)
Z_Hurr=data_1(ii,:);
end
end
disp(Z_Hurr)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings resultant _____ ____ ____ _____________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ _________ 2745 101 12 {'Hurr 90M'} 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9
Now there's no error with contains(), but we only get the last matching row because Z_Hurr is overwritten each time through the loop. To fix that:
Z_Hurr = data_1([],:);
txt = ["Hurricane"; "Hurr"];
for ii=1:size(data_1,1);
x=data_1{ii,4};
if contains(x,txt)
Z_Hurr(end+1,:)=data_1(ii,:);
end
end
disp(Z_Hurr)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings resultant _____ ____ ____ _____________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ _________ 1 1 12 {'Hurricane NL+'} 1 1 {'S1A'} -63 -142 -4471 0 0 0 -63 -142 -4471 NaN 4473.7 29 2 12 {'Hurricane NL-'} 1 1 {'S1A'} -63 -483 -4447 0 0 0 -63 -483 -4447 NaN 4473.6 57 3 12 {'Hurricane NR+'} 1 1 {'S1A'} -63 -141 -4488 0 0 0 -63 -141 -4488 NaN 4490.7 85 4 12 {'Hurricane NR-'} 1 1 {'S1A'} -63 -486 -4464 0 0 0 -63 -486 -4464 NaN 4490.8 113 5 12 {'Hurricane BI+'} 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 141 6 12 {'Hurricane BI-'} 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 701 28 12 {'Hurr -90' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9 729 29 12 {'Hurr -85' } 1 1 {'S1A'} -41 -247 -3586 0 0 0 -41 -247 -3586 NaN 3594.7 757 30 12 {'Hurr -80' } 1 1 {'S1A'} -41 -241 -3591 0 0 0 -41 -241 -3591 NaN 3599.3 785 31 12 {'Hurr -75' } 1 1 {'S1A'} -41 -233 -3600 0 0 0 -41 -233 -3600 NaN 3607.8 813 32 12 {'Hurr -70' } 1 1 {'S1A'} -42 -225 -3622 0 0 0 -42 -225 -3622 NaN 3629.2 841 33 12 {'Hurr -65' } 1 1 {'S1A'} -43 -215 -3662 0 0 0 -43 -215 -3662 NaN 3668.6 869 34 12 {'Hurr -60' } 1 1 {'S1A'} -44 -206 -3714 0 0 0 -44 -206 -3714 NaN 3720 897 35 12 {'Hurr -55' } 1 1 {'S1A'} -46 -196 -3785 0 0 0 -46 -196 -3785 NaN 3790.4 925 36 12 {'Hurr -50' } 1 1 {'S1A'} -48 -187 -3868 0 0 0 -48 -187 -3868 NaN 3872.8 953 37 12 {'Hurr -45' } 1 1 {'S1A'} -50 -178 -3960 0 0 0 -50 -178 -3960 NaN 3964.3 981 38 12 {'Hurr -40' } 1 1 {'S1A'} -53 -170 -4056 0 0 0 -53 -170 -4056 NaN 4059.9 1009 39 12 {'Hurr -35' } 1 1 {'S1A'} -55 -163 -4152 0 0 0 -55 -163 -4152 NaN 4155.6 1037 40 12 {'Hurr -30' } 1 1 {'S1A'} -57 -157 -4244 0 0 0 -57 -157 -4244 NaN 4247.3 1065 41 12 {'Hurr -25' } 1 1 {'S1A'} -59 -152 -4327 0 0 0 -59 -152 -4327 NaN 4330.1 1093 42 12 {'Hurr -20' } 1 1 {'S1A'} -61 -147 -4392 0 0 0 -61 -147 -4392 NaN 4394.9 1121 43 12 {'Hurr -15' } 1 1 {'S1A'} -62 -144 -4445 0 0 0 -62 -144 -4445 NaN 4447.8 1149 44 12 {'Hurr -10' } 1 1 {'S1A'} -63 -142 -4475 0 0 0 -63 -142 -4475 NaN 4477.7 1177 45 12 {'Hurr -5' } 1 1 {'S1A'} -63 -141 -4490 0 0 0 -63 -141 -4490 NaN 4492.7 1205 46 12 {'Hurr 0' } 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 1233 47 12 {'Hurr 5' } 1 1 {'S1A'} -62 -143 -4458 0 0 0 -62 -143 -4458 NaN 4460.7 1261 48 12 {'Hurr 10' } 1 1 {'S1A'} -61 -146 -4414 0 0 0 -61 -146 -4414 NaN 4416.8 1289 49 12 {'Hurr 15' } 1 1 {'S1A'} -60 -150 -4353 0 0 0 -60 -150 -4353 NaN 4356 1317 50 12 {'Hurr 20' } 1 1 {'S1A'} -58 -155 -4279 0 0 0 -58 -155 -4279 NaN 4282.2 1345 51 12 {'Hurr 25' } 1 1 {'S1A'} -56 -161 -4192 0 0 0 -56 -161 -4192 NaN 4195.5 1373 52 12 {'Hurr 30' } 1 1 {'S1A'} -53 -167 -4095 0 0 0 -53 -167 -4095 NaN 4098.7 1401 53 12 {'Hurr 35' } 1 1 {'S1A'} -51 -175 -3999 0 0 0 -51 -175 -3999 NaN 4003.2 1429 54 12 {'Hurr 40' } 1 1 {'S1A'} -49 -183 -3903 0 0 0 -49 -183 -3903 NaN 3907.6 1457 55 12 {'Hurr 45' } 1 1 {'S1A'} -47 -192 -3815 0 0 0 -47 -192 -3815 NaN 3820.1 1485 56 12 {'Hurr 50' } 1 1 {'S1A'} -45 -202 -3741 0 0 0 -45 -202 -3741 NaN 3746.7 1513 57 12 {'Hurr 55' } 1 1 {'S1A'} -43 -211 -3679 0 0 0 -43 -211 -3679 NaN 3685.3 1541 58 12 {'Hurr 60' } 1 1 {'S1A'} -42 -221 -3635 0 0 0 -42 -221 -3635 NaN 3642 1569 59 12 {'Hurr 65' } 1 1 {'S1A'} -41 -230 -3609 0 0 0 -41 -230 -3609 NaN 3616.6 1597 60 12 {'Hurr 70' } 1 1 {'S1A'} -41 -238 -3591 0 0 0 -41 -238 -3591 NaN 3599.1 1625 61 12 {'Hurr 75' } 1 1 {'S1A'} -41 -244 -3586 0 0 0 -41 -244 -3586 NaN 3594.5 1653 62 12 {'Hurr 80' } 1 1 {'S1A'} -41 -249 -3586 0 0 0 -41 -249 -3586 NaN 3594.9 1681 63 12 {'Hurr 85' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 1709 64 12 {'Hurr 90' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1737 65 12 {'Hurr -90M' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1765 66 12 {'Hurr -85M' } 1 1 {'S1A'} -41 -255 -3585 0 0 0 -41 -255 -3585 NaN 3594.3 1793 67 12 {'Hurr -80M' } 1 1 {'S1A'} -41 -262 -3589 0 0 0 -41 -262 -3589 NaN 3598.8 1821 68 12 {'Hurr -75M' } 1 1 {'S1A'} -41 -271 -3597 0 0 0 -41 -271 -3597 NaN 3607.4 1849 69 12 {'Hurr -70M' } 1 1 {'S1A'} -42 -282 -3618 0 0 0 -42 -282 -3618 NaN 3629.2 1877 70 12 {'Hurr -65M' } 1 1 {'S1A'} -43 -297 -3656 0 0 0 -43 -297 -3656 NaN 3668.3 1905 71 12 {'Hurr -60M' } 1 1 {'S1A'} -44 -314 -3707 0 0 0 -44 -314 -3707 NaN 3720.5 1933 72 12 {'Hurr -55M' } 1 1 {'S1A'} -46 -333 -3775 0 0 0 -46 -333 -3775 NaN 3789.9 1961 73 12 {'Hurr -50M' } 1 1 {'S1A'} -48 -354 -3856 0 0 0 -48 -354 -3856 NaN 3872.5 1989 74 12 {'Hurr -45M' } 1 1 {'S1A'} -50 -376 -3946 0 0 0 -50 -376 -3946 NaN 3964.2 2017 75 12 {'Hurr -40M' } 1 1 {'S1A'} -53 -397 -4040 0 0 0 -53 -397 -4040 NaN 4059.8 2045 76 12 {'Hurr -35M' } 1 1 {'S1A'} -55 -417 -4135 0 0 0 -55 -417 -4135 NaN 4156.3 2073 77 12 {'Hurr -30M' } 1 1 {'S1A'} -57 -436 -4225 0 0 0 -57 -436 -4225 NaN 4247.8 2101 78 12 {'Hurr -25M' } 1 1 {'S1A'} -59 -453 -4306 0 0 0 -59 -453 -4306 NaN 4330.2 2129 79 12 {'Hurr -20M' } 1 1 {'S1A'} -61 -466 -4370 0 0 0 -61 -466 -4370 NaN 4395.2 2157 80 12 {'Hurr -15M' } 1 1 {'S1A'} -62 -477 -4421 0 0 0 -62 -477 -4421 NaN 4447.1 2185 81 12 {'Hurr -10M' } 1 1 {'S1A'} -63 -483 -4451 0 0 0 -63 -483 -4451 NaN 4477.6 2213 82 12 {'Hurr -5M' } 1 1 {'S1A'} -63 -486 -4466 0 0 0 -63 -486 -4466 NaN 4492.8 2241 83 12 {'Hurr 0M' } 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 2269 84 12 {'Hurr 5M' } 1 1 {'S1A'} -62 -480 -4434 0 0 0 -62 -480 -4434 NaN 4460.3 2297 85 12 {'Hurr 10M' } 1 1 {'S1A'} -61 -471 -4392 0 0 0 -61 -471 -4392 NaN 4417.6 2325 86 12 {'Hurr 15M' } 1 1 {'S1A'} -60 -459 -4332 0 0 0 -60 -459 -4332 NaN 4356.7 2353 87 12 {'Hurr 20M' } 1 1 {'S1A'} -58 -443 -4259 0 0 0 -58 -443 -4259 NaN 4282.4 2381 88 12 {'Hurr 25M' } 1 1 {'S1A'} -56 -425 -4173 0 0 0 -56 -425 -4173 NaN 4195 2409 89 12 {'Hurr 30M' } 1 1 {'S1A'} -53 -405 -4079 0 0 0 -53 -405 -4079 NaN 4099.4 2437 90 12 {'Hurr 35M' } 1 1 {'S1A'} -51 -384 -3985 0 0 0 -51 -384 -3985 NaN 4003.8 2465 91 12 {'Hurr 40M' } 1 1 {'S1A'} -49 -363 -3891 0 0 0 -49 -363 -3891 NaN 3908.2 2493 92 12 {'Hurr 45M' } 1 1 {'S1A'} -47 -342 -3805 0 0 0 -47 -342 -3805 NaN 3820.6 2521 93 12 {'Hurr 50M' } 1 1 {'S1A'} -45 -322 -3732 0 0 0 -45 -322 -3732 NaN 3746.1 2549 94 12 {'Hurr 55M' } 1 1 {'S1A'} -43 -304 -3673 0 0 0 -43 -304 -3673 NaN 3685.8 2577 95 12 {'Hurr 60M' } 1 1 {'S1A'} -42 -288 -3631 0 0 0 -42 -288 -3631 NaN 3642.6 2605 96 12 {'Hurr 65M' } 1 1 {'S1A'} -41 -275 -3605 0 0 0 -41 -275 -3605 NaN 3615.7 2633 97 12 {'Hurr 70M' } 1 1 {'S1A'} -41 -265 -3589 0 0 0 -41 -265 -3589 NaN 3599 2661 98 12 {'Hurr 75M' } 1 1 {'S1A'} -41 -258 -3585 0 0 0 -41 -258 -3585 NaN 3594.5 2689 99 12 {'Hurr 80M' } 1 1 {'S1A'} -41 -253 -3585 0 0 0 -41 -253 -3585 NaN 3594.2 2717 100 12 {'Hurr 85M' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 2745 101 12 {'Hurr 90M' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9
Also, note that "Hurricane" contains "Hurr", so you could've just checked for "Hurr" rather than either "Hurricane" or "Hurr":
Z_Hurr = data_1([],:);
txt = "Hurr";
for ii=1:size(data_1,1);
x=data_1{ii,4};
if contains(x,txt)
Z_Hurr(end+1,:)=data_1(ii,:);
end
end
disp(Z_Hurr)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings resultant _____ ____ ____ _____________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ _________ 1 1 12 {'Hurricane NL+'} 1 1 {'S1A'} -63 -142 -4471 0 0 0 -63 -142 -4471 NaN 4473.7 29 2 12 {'Hurricane NL-'} 1 1 {'S1A'} -63 -483 -4447 0 0 0 -63 -483 -4447 NaN 4473.6 57 3 12 {'Hurricane NR+'} 1 1 {'S1A'} -63 -141 -4488 0 0 0 -63 -141 -4488 NaN 4490.7 85 4 12 {'Hurricane NR-'} 1 1 {'S1A'} -63 -486 -4464 0 0 0 -63 -486 -4464 NaN 4490.8 113 5 12 {'Hurricane BI+'} 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 141 6 12 {'Hurricane BI-'} 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 701 28 12 {'Hurr -90' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9 729 29 12 {'Hurr -85' } 1 1 {'S1A'} -41 -247 -3586 0 0 0 -41 -247 -3586 NaN 3594.7 757 30 12 {'Hurr -80' } 1 1 {'S1A'} -41 -241 -3591 0 0 0 -41 -241 -3591 NaN 3599.3 785 31 12 {'Hurr -75' } 1 1 {'S1A'} -41 -233 -3600 0 0 0 -41 -233 -3600 NaN 3607.8 813 32 12 {'Hurr -70' } 1 1 {'S1A'} -42 -225 -3622 0 0 0 -42 -225 -3622 NaN 3629.2 841 33 12 {'Hurr -65' } 1 1 {'S1A'} -43 -215 -3662 0 0 0 -43 -215 -3662 NaN 3668.6 869 34 12 {'Hurr -60' } 1 1 {'S1A'} -44 -206 -3714 0 0 0 -44 -206 -3714 NaN 3720 897 35 12 {'Hurr -55' } 1 1 {'S1A'} -46 -196 -3785 0 0 0 -46 -196 -3785 NaN 3790.4 925 36 12 {'Hurr -50' } 1 1 {'S1A'} -48 -187 -3868 0 0 0 -48 -187 -3868 NaN 3872.8 953 37 12 {'Hurr -45' } 1 1 {'S1A'} -50 -178 -3960 0 0 0 -50 -178 -3960 NaN 3964.3 981 38 12 {'Hurr -40' } 1 1 {'S1A'} -53 -170 -4056 0 0 0 -53 -170 -4056 NaN 4059.9 1009 39 12 {'Hurr -35' } 1 1 {'S1A'} -55 -163 -4152 0 0 0 -55 -163 -4152 NaN 4155.6 1037 40 12 {'Hurr -30' } 1 1 {'S1A'} -57 -157 -4244 0 0 0 -57 -157 -4244 NaN 4247.3 1065 41 12 {'Hurr -25' } 1 1 {'S1A'} -59 -152 -4327 0 0 0 -59 -152 -4327 NaN 4330.1 1093 42 12 {'Hurr -20' } 1 1 {'S1A'} -61 -147 -4392 0 0 0 -61 -147 -4392 NaN 4394.9 1121 43 12 {'Hurr -15' } 1 1 {'S1A'} -62 -144 -4445 0 0 0 -62 -144 -4445 NaN 4447.8 1149 44 12 {'Hurr -10' } 1 1 {'S1A'} -63 -142 -4475 0 0 0 -63 -142 -4475 NaN 4477.7 1177 45 12 {'Hurr -5' } 1 1 {'S1A'} -63 -141 -4490 0 0 0 -63 -141 -4490 NaN 4492.7 1205 46 12 {'Hurr 0' } 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 1233 47 12 {'Hurr 5' } 1 1 {'S1A'} -62 -143 -4458 0 0 0 -62 -143 -4458 NaN 4460.7 1261 48 12 {'Hurr 10' } 1 1 {'S1A'} -61 -146 -4414 0 0 0 -61 -146 -4414 NaN 4416.8 1289 49 12 {'Hurr 15' } 1 1 {'S1A'} -60 -150 -4353 0 0 0 -60 -150 -4353 NaN 4356 1317 50 12 {'Hurr 20' } 1 1 {'S1A'} -58 -155 -4279 0 0 0 -58 -155 -4279 NaN 4282.2 1345 51 12 {'Hurr 25' } 1 1 {'S1A'} -56 -161 -4192 0 0 0 -56 -161 -4192 NaN 4195.5 1373 52 12 {'Hurr 30' } 1 1 {'S1A'} -53 -167 -4095 0 0 0 -53 -167 -4095 NaN 4098.7 1401 53 12 {'Hurr 35' } 1 1 {'S1A'} -51 -175 -3999 0 0 0 -51 -175 -3999 NaN 4003.2 1429 54 12 {'Hurr 40' } 1 1 {'S1A'} -49 -183 -3903 0 0 0 -49 -183 -3903 NaN 3907.6 1457 55 12 {'Hurr 45' } 1 1 {'S1A'} -47 -192 -3815 0 0 0 -47 -192 -3815 NaN 3820.1 1485 56 12 {'Hurr 50' } 1 1 {'S1A'} -45 -202 -3741 0 0 0 -45 -202 -3741 NaN 3746.7 1513 57 12 {'Hurr 55' } 1 1 {'S1A'} -43 -211 -3679 0 0 0 -43 -211 -3679 NaN 3685.3 1541 58 12 {'Hurr 60' } 1 1 {'S1A'} -42 -221 -3635 0 0 0 -42 -221 -3635 NaN 3642 1569 59 12 {'Hurr 65' } 1 1 {'S1A'} -41 -230 -3609 0 0 0 -41 -230 -3609 NaN 3616.6 1597 60 12 {'Hurr 70' } 1 1 {'S1A'} -41 -238 -3591 0 0 0 -41 -238 -3591 NaN 3599.1 1625 61 12 {'Hurr 75' } 1 1 {'S1A'} -41 -244 -3586 0 0 0 -41 -244 -3586 NaN 3594.5 1653 62 12 {'Hurr 80' } 1 1 {'S1A'} -41 -249 -3586 0 0 0 -41 -249 -3586 NaN 3594.9 1681 63 12 {'Hurr 85' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 1709 64 12 {'Hurr 90' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1737 65 12 {'Hurr -90M' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1765 66 12 {'Hurr -85M' } 1 1 {'S1A'} -41 -255 -3585 0 0 0 -41 -255 -3585 NaN 3594.3 1793 67 12 {'Hurr -80M' } 1 1 {'S1A'} -41 -262 -3589 0 0 0 -41 -262 -3589 NaN 3598.8 1821 68 12 {'Hurr -75M' } 1 1 {'S1A'} -41 -271 -3597 0 0 0 -41 -271 -3597 NaN 3607.4 1849 69 12 {'Hurr -70M' } 1 1 {'S1A'} -42 -282 -3618 0 0 0 -42 -282 -3618 NaN 3629.2 1877 70 12 {'Hurr -65M' } 1 1 {'S1A'} -43 -297 -3656 0 0 0 -43 -297 -3656 NaN 3668.3 1905 71 12 {'Hurr -60M' } 1 1 {'S1A'} -44 -314 -3707 0 0 0 -44 -314 -3707 NaN 3720.5 1933 72 12 {'Hurr -55M' } 1 1 {'S1A'} -46 -333 -3775 0 0 0 -46 -333 -3775 NaN 3789.9 1961 73 12 {'Hurr -50M' } 1 1 {'S1A'} -48 -354 -3856 0 0 0 -48 -354 -3856 NaN 3872.5 1989 74 12 {'Hurr -45M' } 1 1 {'S1A'} -50 -376 -3946 0 0 0 -50 -376 -3946 NaN 3964.2 2017 75 12 {'Hurr -40M' } 1 1 {'S1A'} -53 -397 -4040 0 0 0 -53 -397 -4040 NaN 4059.8 2045 76 12 {'Hurr -35M' } 1 1 {'S1A'} -55 -417 -4135 0 0 0 -55 -417 -4135 NaN 4156.3 2073 77 12 {'Hurr -30M' } 1 1 {'S1A'} -57 -436 -4225 0 0 0 -57 -436 -4225 NaN 4247.8 2101 78 12 {'Hurr -25M' } 1 1 {'S1A'} -59 -453 -4306 0 0 0 -59 -453 -4306 NaN 4330.2 2129 79 12 {'Hurr -20M' } 1 1 {'S1A'} -61 -466 -4370 0 0 0 -61 -466 -4370 NaN 4395.2 2157 80 12 {'Hurr -15M' } 1 1 {'S1A'} -62 -477 -4421 0 0 0 -62 -477 -4421 NaN 4447.1 2185 81 12 {'Hurr -10M' } 1 1 {'S1A'} -63 -483 -4451 0 0 0 -63 -483 -4451 NaN 4477.6 2213 82 12 {'Hurr -5M' } 1 1 {'S1A'} -63 -486 -4466 0 0 0 -63 -486 -4466 NaN 4492.8 2241 83 12 {'Hurr 0M' } 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 2269 84 12 {'Hurr 5M' } 1 1 {'S1A'} -62 -480 -4434 0 0 0 -62 -480 -4434 NaN 4460.3 2297 85 12 {'Hurr 10M' } 1 1 {'S1A'} -61 -471 -4392 0 0 0 -61 -471 -4392 NaN 4417.6 2325 86 12 {'Hurr 15M' } 1 1 {'S1A'} -60 -459 -4332 0 0 0 -60 -459 -4332 NaN 4356.7 2353 87 12 {'Hurr 20M' } 1 1 {'S1A'} -58 -443 -4259 0 0 0 -58 -443 -4259 NaN 4282.4 2381 88 12 {'Hurr 25M' } 1 1 {'S1A'} -56 -425 -4173 0 0 0 -56 -425 -4173 NaN 4195 2409 89 12 {'Hurr 30M' } 1 1 {'S1A'} -53 -405 -4079 0 0 0 -53 -405 -4079 NaN 4099.4 2437 90 12 {'Hurr 35M' } 1 1 {'S1A'} -51 -384 -3985 0 0 0 -51 -384 -3985 NaN 4003.8 2465 91 12 {'Hurr 40M' } 1 1 {'S1A'} -49 -363 -3891 0 0 0 -49 -363 -3891 NaN 3908.2 2493 92 12 {'Hurr 45M' } 1 1 {'S1A'} -47 -342 -3805 0 0 0 -47 -342 -3805 NaN 3820.6 2521 93 12 {'Hurr 50M' } 1 1 {'S1A'} -45 -322 -3732 0 0 0 -45 -322 -3732 NaN 3746.1 2549 94 12 {'Hurr 55M' } 1 1 {'S1A'} -43 -304 -3673 0 0 0 -43 -304 -3673 NaN 3685.8 2577 95 12 {'Hurr 60M' } 1 1 {'S1A'} -42 -288 -3631 0 0 0 -42 -288 -3631 NaN 3642.6 2605 96 12 {'Hurr 65M' } 1 1 {'S1A'} -41 -275 -3605 0 0 0 -41 -275 -3605 NaN 3615.7 2633 97 12 {'Hurr 70M' } 1 1 {'S1A'} -41 -265 -3589 0 0 0 -41 -265 -3589 NaN 3599 2661 98 12 {'Hurr 75M' } 1 1 {'S1A'} -41 -258 -3585 0 0 0 -41 -258 -3585 NaN 3594.5 2689 99 12 {'Hurr 80M' } 1 1 {'S1A'} -41 -253 -3585 0 0 0 -41 -253 -3585 NaN 3594.2 2717 100 12 {'Hurr 85M' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 2745 101 12 {'Hurr 90M' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9
Or you could avoid the for loop entirely, by using logical indexing:
Z_Hurr = data_1(contains(data_1{:,4},"Hurr"),:);
disp(Z_Hurr)
Row # LC # WC # Load Case Description Set No. Phase No. Attach. Joint Labels Structure Loads Vert. (lbs) Structure Loads Trans. (lbs) Structure Loads Long. (lbs) Loads from back span Vert. (lbs) Loads from back span Trans. (lbs) Loads from back span Long. (lbs) Loads from ahead span Vert. (lbs) Loads from ahead span Trans. (lbs) Loads from ahead span Long. (lbs) Warnings resultant _____ ____ ____ _____________________ _______ _________ ____________________ ___________________________ ____________________________ ___________________________ ________________________________ _________________________________ ________________________________ _________________________________ __________________________________ _________________________________ ________ _________ 1 1 12 {'Hurricane NL+'} 1 1 {'S1A'} -63 -142 -4471 0 0 0 -63 -142 -4471 NaN 4473.7 29 2 12 {'Hurricane NL-'} 1 1 {'S1A'} -63 -483 -4447 0 0 0 -63 -483 -4447 NaN 4473.6 57 3 12 {'Hurricane NR+'} 1 1 {'S1A'} -63 -141 -4488 0 0 0 -63 -141 -4488 NaN 4490.7 85 4 12 {'Hurricane NR-'} 1 1 {'S1A'} -63 -486 -4464 0 0 0 -63 -486 -4464 NaN 4490.8 113 5 12 {'Hurricane BI+'} 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 141 6 12 {'Hurricane BI-'} 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 701 28 12 {'Hurr -90' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9 729 29 12 {'Hurr -85' } 1 1 {'S1A'} -41 -247 -3586 0 0 0 -41 -247 -3586 NaN 3594.7 757 30 12 {'Hurr -80' } 1 1 {'S1A'} -41 -241 -3591 0 0 0 -41 -241 -3591 NaN 3599.3 785 31 12 {'Hurr -75' } 1 1 {'S1A'} -41 -233 -3600 0 0 0 -41 -233 -3600 NaN 3607.8 813 32 12 {'Hurr -70' } 1 1 {'S1A'} -42 -225 -3622 0 0 0 -42 -225 -3622 NaN 3629.2 841 33 12 {'Hurr -65' } 1 1 {'S1A'} -43 -215 -3662 0 0 0 -43 -215 -3662 NaN 3668.6 869 34 12 {'Hurr -60' } 1 1 {'S1A'} -44 -206 -3714 0 0 0 -44 -206 -3714 NaN 3720 897 35 12 {'Hurr -55' } 1 1 {'S1A'} -46 -196 -3785 0 0 0 -46 -196 -3785 NaN 3790.4 925 36 12 {'Hurr -50' } 1 1 {'S1A'} -48 -187 -3868 0 0 0 -48 -187 -3868 NaN 3872.8 953 37 12 {'Hurr -45' } 1 1 {'S1A'} -50 -178 -3960 0 0 0 -50 -178 -3960 NaN 3964.3 981 38 12 {'Hurr -40' } 1 1 {'S1A'} -53 -170 -4056 0 0 0 -53 -170 -4056 NaN 4059.9 1009 39 12 {'Hurr -35' } 1 1 {'S1A'} -55 -163 -4152 0 0 0 -55 -163 -4152 NaN 4155.6 1037 40 12 {'Hurr -30' } 1 1 {'S1A'} -57 -157 -4244 0 0 0 -57 -157 -4244 NaN 4247.3 1065 41 12 {'Hurr -25' } 1 1 {'S1A'} -59 -152 -4327 0 0 0 -59 -152 -4327 NaN 4330.1 1093 42 12 {'Hurr -20' } 1 1 {'S1A'} -61 -147 -4392 0 0 0 -61 -147 -4392 NaN 4394.9 1121 43 12 {'Hurr -15' } 1 1 {'S1A'} -62 -144 -4445 0 0 0 -62 -144 -4445 NaN 4447.8 1149 44 12 {'Hurr -10' } 1 1 {'S1A'} -63 -142 -4475 0 0 0 -63 -142 -4475 NaN 4477.7 1177 45 12 {'Hurr -5' } 1 1 {'S1A'} -63 -141 -4490 0 0 0 -63 -141 -4490 NaN 4492.7 1205 46 12 {'Hurr 0' } 1 1 {'S1A'} -63 -141 -4484 0 0 0 -63 -141 -4484 NaN 4486.7 1233 47 12 {'Hurr 5' } 1 1 {'S1A'} -62 -143 -4458 0 0 0 -62 -143 -4458 NaN 4460.7 1261 48 12 {'Hurr 10' } 1 1 {'S1A'} -61 -146 -4414 0 0 0 -61 -146 -4414 NaN 4416.8 1289 49 12 {'Hurr 15' } 1 1 {'S1A'} -60 -150 -4353 0 0 0 -60 -150 -4353 NaN 4356 1317 50 12 {'Hurr 20' } 1 1 {'S1A'} -58 -155 -4279 0 0 0 -58 -155 -4279 NaN 4282.2 1345 51 12 {'Hurr 25' } 1 1 {'S1A'} -56 -161 -4192 0 0 0 -56 -161 -4192 NaN 4195.5 1373 52 12 {'Hurr 30' } 1 1 {'S1A'} -53 -167 -4095 0 0 0 -53 -167 -4095 NaN 4098.7 1401 53 12 {'Hurr 35' } 1 1 {'S1A'} -51 -175 -3999 0 0 0 -51 -175 -3999 NaN 4003.2 1429 54 12 {'Hurr 40' } 1 1 {'S1A'} -49 -183 -3903 0 0 0 -49 -183 -3903 NaN 3907.6 1457 55 12 {'Hurr 45' } 1 1 {'S1A'} -47 -192 -3815 0 0 0 -47 -192 -3815 NaN 3820.1 1485 56 12 {'Hurr 50' } 1 1 {'S1A'} -45 -202 -3741 0 0 0 -45 -202 -3741 NaN 3746.7 1513 57 12 {'Hurr 55' } 1 1 {'S1A'} -43 -211 -3679 0 0 0 -43 -211 -3679 NaN 3685.3 1541 58 12 {'Hurr 60' } 1 1 {'S1A'} -42 -221 -3635 0 0 0 -42 -221 -3635 NaN 3642 1569 59 12 {'Hurr 65' } 1 1 {'S1A'} -41 -230 -3609 0 0 0 -41 -230 -3609 NaN 3616.6 1597 60 12 {'Hurr 70' } 1 1 {'S1A'} -41 -238 -3591 0 0 0 -41 -238 -3591 NaN 3599.1 1625 61 12 {'Hurr 75' } 1 1 {'S1A'} -41 -244 -3586 0 0 0 -41 -244 -3586 NaN 3594.5 1653 62 12 {'Hurr 80' } 1 1 {'S1A'} -41 -249 -3586 0 0 0 -41 -249 -3586 NaN 3594.9 1681 63 12 {'Hurr 85' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 1709 64 12 {'Hurr 90' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1737 65 12 {'Hurr -90M' } 1 1 {'S1A'} -41 -252 -3585 0 0 0 -41 -252 -3585 NaN 3594.1 1765 66 12 {'Hurr -85M' } 1 1 {'S1A'} -41 -255 -3585 0 0 0 -41 -255 -3585 NaN 3594.3 1793 67 12 {'Hurr -80M' } 1 1 {'S1A'} -41 -262 -3589 0 0 0 -41 -262 -3589 NaN 3598.8 1821 68 12 {'Hurr -75M' } 1 1 {'S1A'} -41 -271 -3597 0 0 0 -41 -271 -3597 NaN 3607.4 1849 69 12 {'Hurr -70M' } 1 1 {'S1A'} -42 -282 -3618 0 0 0 -42 -282 -3618 NaN 3629.2 1877 70 12 {'Hurr -65M' } 1 1 {'S1A'} -43 -297 -3656 0 0 0 -43 -297 -3656 NaN 3668.3 1905 71 12 {'Hurr -60M' } 1 1 {'S1A'} -44 -314 -3707 0 0 0 -44 -314 -3707 NaN 3720.5 1933 72 12 {'Hurr -55M' } 1 1 {'S1A'} -46 -333 -3775 0 0 0 -46 -333 -3775 NaN 3789.9 1961 73 12 {'Hurr -50M' } 1 1 {'S1A'} -48 -354 -3856 0 0 0 -48 -354 -3856 NaN 3872.5 1989 74 12 {'Hurr -45M' } 1 1 {'S1A'} -50 -376 -3946 0 0 0 -50 -376 -3946 NaN 3964.2 2017 75 12 {'Hurr -40M' } 1 1 {'S1A'} -53 -397 -4040 0 0 0 -53 -397 -4040 NaN 4059.8 2045 76 12 {'Hurr -35M' } 1 1 {'S1A'} -55 -417 -4135 0 0 0 -55 -417 -4135 NaN 4156.3 2073 77 12 {'Hurr -30M' } 1 1 {'S1A'} -57 -436 -4225 0 0 0 -57 -436 -4225 NaN 4247.8 2101 78 12 {'Hurr -25M' } 1 1 {'S1A'} -59 -453 -4306 0 0 0 -59 -453 -4306 NaN 4330.2 2129 79 12 {'Hurr -20M' } 1 1 {'S1A'} -61 -466 -4370 0 0 0 -61 -466 -4370 NaN 4395.2 2157 80 12 {'Hurr -15M' } 1 1 {'S1A'} -62 -477 -4421 0 0 0 -62 -477 -4421 NaN 4447.1 2185 81 12 {'Hurr -10M' } 1 1 {'S1A'} -63 -483 -4451 0 0 0 -63 -483 -4451 NaN 4477.6 2213 82 12 {'Hurr -5M' } 1 1 {'S1A'} -63 -486 -4466 0 0 0 -63 -486 -4466 NaN 4492.8 2241 83 12 {'Hurr 0M' } 1 1 {'S1A'} -63 -485 -4460 0 0 0 -63 -485 -4460 NaN 4486.7 2269 84 12 {'Hurr 5M' } 1 1 {'S1A'} -62 -480 -4434 0 0 0 -62 -480 -4434 NaN 4460.3 2297 85 12 {'Hurr 10M' } 1 1 {'S1A'} -61 -471 -4392 0 0 0 -61 -471 -4392 NaN 4417.6 2325 86 12 {'Hurr 15M' } 1 1 {'S1A'} -60 -459 -4332 0 0 0 -60 -459 -4332 NaN 4356.7 2353 87 12 {'Hurr 20M' } 1 1 {'S1A'} -58 -443 -4259 0 0 0 -58 -443 -4259 NaN 4282.4 2381 88 12 {'Hurr 25M' } 1 1 {'S1A'} -56 -425 -4173 0 0 0 -56 -425 -4173 NaN 4195 2409 89 12 {'Hurr 30M' } 1 1 {'S1A'} -53 -405 -4079 0 0 0 -53 -405 -4079 NaN 4099.4 2437 90 12 {'Hurr 35M' } 1 1 {'S1A'} -51 -384 -3985 0 0 0 -51 -384 -3985 NaN 4003.8 2465 91 12 {'Hurr 40M' } 1 1 {'S1A'} -49 -363 -3891 0 0 0 -49 -363 -3891 NaN 3908.2 2493 92 12 {'Hurr 45M' } 1 1 {'S1A'} -47 -342 -3805 0 0 0 -47 -342 -3805 NaN 3820.6 2521 93 12 {'Hurr 50M' } 1 1 {'S1A'} -45 -322 -3732 0 0 0 -45 -322 -3732 NaN 3746.1 2549 94 12 {'Hurr 55M' } 1 1 {'S1A'} -43 -304 -3673 0 0 0 -43 -304 -3673 NaN 3685.8 2577 95 12 {'Hurr 60M' } 1 1 {'S1A'} -42 -288 -3631 0 0 0 -42 -288 -3631 NaN 3642.6 2605 96 12 {'Hurr 65M' } 1 1 {'S1A'} -41 -275 -3605 0 0 0 -41 -275 -3605 NaN 3615.7 2633 97 12 {'Hurr 70M' } 1 1 {'S1A'} -41 -265 -3589 0 0 0 -41 -265 -3589 NaN 3599 2661 98 12 {'Hurr 75M' } 1 1 {'S1A'} -41 -258 -3585 0 0 0 -41 -258 -3585 NaN 3594.5 2689 99 12 {'Hurr 80M' } 1 1 {'S1A'} -41 -253 -3585 0 0 0 -41 -253 -3585 NaN 3594.2 2717 100 12 {'Hurr 85M' } 1 1 {'S1A'} -41 -251 -3586 0 0 0 -41 -251 -3586 NaN 3595 2745 101 12 {'Hurr 90M' } 1 1 {'S1A'} -41 -250 -3586 0 0 0 -41 -250 -3586 NaN 3594.9
  2 Comments
Steven Lord
Steven Lord on 28 Jan 2022
You explained why the code in the original message threw an error in the middle of your explanation. To highlight that root cause, you cannot call contains (or startsWith etc.) on a table array but you can call it on a variable extracted from a table array.
load patients
P = table(LastName, Age);
head(P)
ans = 8×2 table
LastName Age ____________ ___ {'Smith' } 38 {'Johnson' } 43 {'Williams'} 38 {'Jones' } 40 {'Brown' } 49 {'Davis' } 46 {'Miller' } 33 {'Wilson' } 40
% This works
namesStartingWithJ = startsWith(P.LastName, 'J');
P(namesStartingWithJ, :)
ans = 5×2 table
LastName Age ___________ ___ {'Johnson'} 43 {'Jones' } 40 {'Jackson'} 25 {'James' } 25 {'Jenkins'} 28
% This will not work
N = startsWith(P, 'J');
Error using startsWith
First argument must be text.

Sign in to comment.

More Answers (0)

Categories

Find more on Cell Arrays in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!