In Matlab, I have an array that has labels, for example
Events = [10; 11; 41; 42; 31; 32; 41; 42];
I want to edit this array so that after each 41
I insert 8 411
s such that I end up with:
New_events = [10; 11; 41; 411; 411; 411; 411; 411; 411; 411; 411; 42; 31;
32; 41; 411; 411; 411; 411; 411; 411; 411; 411; 42];
Is there a simple way to do this?
I have used find
to get the indices of each occurrence of 41
but am unsure how to preserve the order of the other labels... Does anyone know how I could do this?
I have just posted a small example of the what the array looks like but in reality, it is much bigger and I need to do this many times (appx 200 times) so I need something automated...
Thanks