So I have rows with the following possible data.
+----------------------------------------------------------------------+----------------------------------------------------------------------+------+------+| ip | neighbor | val1 | val2 |+----------------------------------------------------------------------+----------------------------------------------------------------------+------+------+| can have any random value ranging from 192.168.2.101 - 192.168.2.110 | can have any random value ranging from 192.168.2.101 - 192.168.2.110 | - | - |+----------------------------------------------------------------------+----------------------------------------------------------------------+------+------+
I know in order to populate a variable with portion of the table I do this (lq being my table variable) :
T = lq(strcmp(lq.ip, '192.168.2.101') & strcmp(lq.neighbor, '192.168.2.102'), :) ;
the problem is that I need to write some code that will store all possible combinations of this ip and neighbor (except where they are same) and store it in a different variable.
That is if I would have to hand code it would be,
T1 = lq(strcmp(lq.ip, '192.168.2.101') & strcmp(lq.neighbor, '192.168.2.102'), :) ; T2 = lq(strcmp(lq.ip, '192.168.2.101') & strcmp(lq.neighbor, '192.168.2.103'), :) ; T3 = lq(strcmp(lq.ip, '192.168.2.101') & strcmp(lq.neighbor, '192.168.2.104'), :) ; . . . T73 = lq(strcmp(lq.ip, '192.168.2.110') & strcmp(lq.neighbor, '192.168.2.101'), :) ; . . T79 = lq(strcmp(lq.ip, '192.168.2.110') & strcmp(lq.neighbor, '192.168.2.109'), :) ;
Is there a faster no naive way to do it? Thanks!
Best Answer