Splitting Table Based on One Column Value
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!