I want to subset values in a table based on a range of numbers specific to one of my variables.

5 vues (au cours des 30 derniers jours)
I have variable W and variable A. I would like to create separate tables based on a specified range of W. For example, if my first range is 450-400, I would like all of the values of W that fit into this range to make a separate table containing both W and A values.

Réponses (1)

David Hill
David Hill le 15 Août 2022
W=randi(500,100,1);
A=randi(500,100,1);
M=[W(W>=400&W<+450),A(W>=400&W<+450)]
M = 9×2
400 78 412 177 448 49 423 95 442 115 405 429 428 250 401 492 422 159

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by