Having problems with deal assignment function
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sanwal Yousaf
il 13 Ago 2015
Risposto: Walter Roberson
il 13 Ago 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.
0 Commenti
Risposta accettata
Walter Roberson
il 13 Ago 2015
Before loop:
NewVal = num2cell(5:16);
In loop:
[x.event(change_data).epochtype] = NewVal{:};
0 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!