Having problems with deal assignment function

2 次查看(过去 30 天)
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.

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by