Adjust multiple cells indexed by logical operator
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Paul
am 12 Nov. 2014
Beantwortet: the cyclist
am 13 Nov. 2014
Dear all,
My problem is combining cells and vectors. I need [nx1] cells (a_label) which can be filled with labels (arrays filled with numbers of different length, e.g. [3 2 6] or [5 10 53 1 6]) A certain cell must be filled with a label if a condition is true, it can be the case that multiple cells must be updated. The problem is a_label{TF} (see below), this is of course not possible, but I don't know how to fix this.
In short: While L <= something
current_node = 3;
current_label = a_label{current_node};
a_label{TF} = [current_label,current_node]___ %(TF is different for every loop)
end
0 Kommentare
Akzeptierte Antwort
the cyclist
am 13 Nov. 2014
I'm not entirely sure I understand. A before-and-after example of what you want a_label to contain, given values of TF and current_node would be helpful.
Here is my best guess, though. It runs, but I am not sure it does what you intend.
TF = [true; true; false];
current_node = 3;
a_label = {[1 2 3 4];[5 6 7];[8 9 10]};
current_label = a_label{current_node};
a_label(TF) = {[current_label,current_node]};
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Troubleshoot Project Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!