So I have a 65×1 array in which the first 42 elements are numbers and the last 23 elements are NaN. I would like to reorganize the array by putting the NaNs at the end into certain indicies within the array that I have flagged.
More simplistically I want something like this:
array = [1,2,3,4,5,NaN,NaN,NaN];idx_flag = [1,4,8];
%i want
new_array = [NaN,1,2,NaN,3,4,5,NaN];
Thanks!
Best Answer