I have a problem about storing multiple elements in a row of an array. I have long code, but i can post short portion of it. There is a ant cell array ( it can be a multidimensional array). After some conditions, this ant{} values will change, but there is some condition multiple element will store in a row.
n=20;for i=1:nant(i,:,t)= {i};ph(i,:,t)=1;del_ph(i,:,t)=0;end ant = [ 1] [ 2] [ 3] [ 4] [ 5] [ 6] [ 7] [ 8] [ 9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
After calculations and some conditions, [8],[9] and [10] will move in [9], and store in this row. I did correctly move other ant{} but not reach the multiple element storing. My expected result is In this below, or like this.
ant = [ 0] [ 1] [ 2] [ 3] [ 4] [ 5] [ 6] [ 7] [ 8] [ 9] [ 10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [ 0]
I tried to write a code but i think i'm bad at using arrays, so i'm stuck. Can you give me any idea? If this question isn't clear, i can post whole code and i can try explain exactly. Sorry, if i repeat same question.
Best Answer