Having problems with deal assignment function

2 views (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 13 Aug 2015
Before loop:
NewVal = num2cell(5:16);
In loop:
[x.event(change_data).epochtype] = NewVal{:};

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!