ignore values in matrix

1 visualización (últimos 30 días)
awais rehman
awais rehman el 15 de Jul. de 2012
I have this matrix
YY =
Columns 1 through 13
623.0000 580.0000 531.8571 482.9231 435.8704 388.7843 342.3571 296.5636 252.1818 209.0000 181.0909 159.0000 137.5000
Columns 14 through 26
115.5000 94.2813 73.5000 79.9000 92.9268 107.3043 122.0286 136.0526 150.5000 165.3333 180.1818 187.0000 192.9167
Columns 27 through 39
198.8462 205.2778 211.5000 217.8125 224.5000 231.0769 238.5000 244.4000 249.6154 255.0000 260.6000 266.5000 272.5000
Columns 40 through 52
278.5000 284.3846 290.3636 296.3333 302.4000 308.4000 313.6923 318.6000 324.5000 329.5833 334.6000 340.3333 345.3077
Columns 53 through 65
350.5000 355.7857 360.6000 365.5000 370.5000 375.2143 379.9333 384.3846 388.6154 393.2500 397.5000 401.6154 405.6923
Columns 66 through 72
409.6923 413.4545 417.3077 420.6000 424.5000 428.2308 431.3333
what i want is to remove all values from YY which are below first 100(starting from top whenever a value gets below 100 ....remove next all values ).In this case ans should look like
YY =
Columns 1 through 13
623.0000 580.0000 531.8571 482.9231 435.8704 388.7843 342.3571 296.5636 252.1818 209.0000 181.0909 159.0000 137.5000
Columns 14 through 26
115.5000
THANK's in advance:)

Respuesta aceptada

Walter Roberson
Walter Roberson el 15 de Jul. de 2012
YY = YY(1 : find(YY < 100, 1, 'first')-1 );

Más respuestas (1)

Wayne King
Wayne King el 15 de Jul. de 2012
One way is to just use logical indexing.
X = [623.0000 580.0000 531.8571 482.9231 435.8704 388.7843 342.3571 296.5636 252.1818 209.0000 181.0909 159.0000 137.5000
115.5000 94.2813 73.5000 79.9000 92.9268 107.3043 122.0286 136.0526 150.5000 165.3333 180.1818 187.0000 192.9167
198.8462 205.2778 211.5000 217.8125 224.5000 231.0769 238.5000 244.4000 249.6154 255.0000 260.6000 266.5000 272.5000
278.5000 284.3846 290.3636 296.3333 302.4000 308.4000 313.6923 318.6000 324.5000 329.5833 334.6000 340.3333 345.3077
350.5000 355.7857 360.6000 365.5000 370.5000 375.2143 379.9333 384.3846 388.6154 393.2500 397.5000 401.6154 405.6923
];
Y = X(X>100);
  1 comentario
awais rehman
awais rehman el 15 de Jul. de 2012
this returns ...
Y =
Columns 1 through 13
623.0000 580.0000 531.8571 482.9231 435.8704 388.7843 342.3571 296.5636 252.1818 209.0000 181.0909 159.0000 137.5000
Columns 14 through 26
115.5000 107.3043 122.0286 136.0526 150.5000 165.3333 180.1818 187.0000 192.9167 198.8462 205.2778 211.5000 217.8125
Columns 27 through 39
224.5000 231.0769 238.5000 244.4000 249.6154 255.0000 260.6000 266.5000 272.5000 278.5000 284.3846 290.3636 296.3333
Columns 40 through 52
302.4000 308.4000 313.6923 318.6000 324.5000 329.5833 334.6000 340.3333 345.3077 350.5000 355.7857 360.6000 365.5000
Columns 53 through 65
370.5000 375.2143 379.9333 384.3846 388.6154 393.2500 397.5000 401.6154 405.6923 409.6923 413.4545 417.3077 420.6000
Columns 66 through 68
424.5000 428.2308 431.3333

Iniciar sesión para comentar.

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by