MATLAB: Having problems with deal assignment function

arraydealmanipulationMATLABmatrixmatrix manipulation

I am using
if option ==2
for ii= 1:size(search_9,2)
ii;
temp= x.event(ii).epochtype;
if search_9(ii)+7 <= size(x.event,2) %(ii+7) is the wrong syntax, use (ii)+7 to specify elements from ii to 11+7
if search_9(ii)-4 >= size(x.event,1); %had to change from x.event.epochtype to x.event
change_data = search_9(ii) + [-4:7];
[x.event(change_data).epochtype] = deal(5:16);
end
end
end
%disp([temp x.event(ii).epochtype]);
end
end
The search_9 function is defined earlier and looks for 9 in the specified structure.
the deal function is causing each of the index that is being specified to get 5:16, so it takes index 17 and replaces that number with 5:16. Is there another function that i could use or any way that i could fix it.

Best Answer

Before loop:
NewVal = num2cell(5:16);
In loop:
[x.event(change_data).epochtype] = NewVal{:};