Splitting Table Based on One Column Value
Afficher commentaires plus anciens
Hello,
I have a 1790x34 table of values called dP, and I would like to create two other tables based on a variable called 'A_VAL'. If the value under the 'A_VAL' variable is less than 0.1, then it is stored in the 'lo_val' table, but it is stored in the 'hi_val' table if it is greater-than or equal-to 0.1. I have tried the following code:
idx = dP(:,'A_VAL') < 0.1;
lo_val = dP(idx,:)
hi_val = dP(~idx, :)
But, unfortunately, it gives me the following error:
Error using ()
A table row subscript must be a numeric array containing real positive integers, a logical array, a
character vector, a string array, a cell array of character vectors, or a pattern scalar.
Error in Hedwig_HS_input (line 14)
lo_val = dP(idx,:)
Any assistance would be greatly appreciated, thank you!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!