Hello all,
I am working with appdesigner to plot curves and act on the data plotted. I use for that a Tree, with nodes representing data. They come as shown below, by pair of subnodes representing raw/treated data with a common Parent node representing the file.
I wanted to add a "Group" function to allow to regroup nodes in the hierarchy. So I used the code below.
function Group_nodes(app,inputNodes)
nb_Nodes = length(inputNodes);
node_to_be_moved = inputNodes(2).Parent;
move(node_to_be_moved, inputNodes(1).Parent);
if inputNodes(k).Parent ~= node_to_be_moved
node_to_be_moved = inputNodes(k).Parent;
move(node_to_be_moved, inputNodes(1).Parent);
What it does is to sweep through the selected nodes and bring them one by one next to the first one. The actual movement is performed on the "Parent" nodes, so I included an if condition to prevent the action from being repeated twice for siblings (Raw/Treated).
The poblem is that the execution time is increasing with the number of iteration in the loop, and can get really high. By measuring the time with tic / toc functions I obtain the following vector with each iteration: (the low values are the cases when the move function is not used as the if condition is not fullfilled).
I don't understand the reason behind this exponential time increase. Is it coming from the move(node1, node 2) function ?
Do you know how to prevent this ?