biologist new to matlab
- From: abeyer42@xxxxxxxxx
- Date: 14 Apr 2007 19:27:03 -0700
Hi,
I'm a neurobiologist new to matlab (and programming), and I've an
elementary question:
I have a vector of spike times from a physiology experiment. I'd
like to create a binned timeseries. For example, suppose my
experiment is 20 msec long and spikes occur at 4, 10, and 15 msec,
and I choose my bin length to be 1 msec. What I'm trying to code is a
way to convert my raw data (a 1x3 array) to a 1x20 array in which
each element is zero, except for the fourth, tenth, and fifteenth,
which would be one.
I attempted to do things this way:
A = zeros(1,20)
m = []
for i = 1:length(A)
t = find(A(i) == 4)
A(t) = 1
end
but this won't work b/c find(A(n)) will not return the index of A(n).
I thought if I could create a vector (A) of (say) 20 zeros, I could
write a script to convert an element in A whose index matched the
value of an element in my raw data to 1. But I can't find a way to say
"if the value of the index is thus, then perform x" only ways to say
"if the value of the element at some index 'n' is thus, then perform
x".
thanks for any suggestions.
aaron
.
- Follow-Ups:
- Re: biologist new to matlab
- From: NZTideMan
- Re: biologist new to matlab
- Prev by Date: Re: 80 solution manual to various textbook(pdf)
- Next by Date: Re: Problem of the same names (Version.dll & Input.dll) as Matlab Builtin
- Previous by thread: calculating bit error rate of ASK
- Next by thread: Re: biologist new to matlab
- Index(es):
Relevant Pages
|