Filter löschen
Filter löschen

Having problems with deal assignment function

3 Ansichten (letzte 30 Tage)
Sanwal Yousaf
Sanwal Yousaf am 13 Aug. 2015
Beantwortet: Walter Roberson am 13 Aug. 2015
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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by