Skip to content

Instantly share code, notes, and snippets.

@indapa
Created October 2, 2012 14:53
Show Gist options
  • Save indapa/3819778 to your computer and use it in GitHub Desktop.
Save indapa/3819778 to your computer and use it in GitHub Desktop.
set elements of vector to a value given a list of indices
val=randn(1,10); % get 10 random values
indx=[10 9 8 7 6 5 4 3 2 1] % vector representing indices
value(indx)=val % set the indices of value to value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment