Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
how to display the values of an array within the specific bin ranges (index positions)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
i have [1xm] array.How to display the values of an array within the specific bin ranges (index positions)?
ex:
x=[1 2 4 5 7 5 7 8 3 12 45 32 54 67]
idx1=[2 7 12]
idx2=[5 10 14]
output is again [1xm] matrix
y=[0 2 4 5 7 0 7 8 3 12 0 32 54 67]
0 Kommentare
Antworten (1)
Guillaume
am 2 Nov. 2016
One possible solution:
y = zeros(size(x));
indices = cell2mat(arrayfun(@(istart, iend) istart:iend, idx1, idx2, 'UniformOutput', false));
y(indices) = x(indices)
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!