Re: Replicate from [1, 148] to [1000, 148] [message #30344] |
Thu, 18 April 2002 18:46 |
Wang, Chi-Kuei
Messages: 6 Registered: April 2002
|
Junior Member |
|
|
Thank you all.
Chi-Kuei
chi-kuei <cw94@cornell.edu> wrote in message
news:a9nar8$pg7$1@news01.cit.cornell.edu...
> Hi all,
>
> I have a [1000,148] matrix. Each column is a data stream and needs to be
> subtracted by a [1,148] matrix. Since I can't find a way to do it in one
IDL
> line, i.e.,
>
> [1000,148]-[1,148]
>
> I have to do it this way:
>
> [1000,148] - replicate([1,148], 1000)
>
> However, the replicate won't do the job. Right now I am doing this by a
> loop. This really slows the procedure down. Is there any better way to do
> it?
>
> Thanks,
>
> Chi-Kuei
>
>
|
|
|
|
Re: Replicate from [1, 148] to [1000, 148] [message #30347 is a reply to message #30346] |
Thu, 18 April 2002 13:46  |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
"chi-kuei" <cw94@cornell.edu> wrote in message
news:a9nar8$pg7$1@news01.cit.cornell.edu...
> Hi all,
>
> I have a [1000,148] matrix. Each column is a data stream and needs to be
> subtracted by a [1,148] matrix. Since I can't find a way to do it in one
IDL
> line, i.e.,
>
> [1000,148]-[1,148]
>
> I have to do it this way:
>
> [1000,148] - replicate([1,148], 1000)
>
> However, the replicate won't do the job. Right now I am doing this by a
> loop. This really slows the procedure down. Is there any better way to do
> it?
Using your informal notation, this is a good way to do it:
[1000,148] - Rebin([1,148], 1000, 148)
This effectively copies each item across the 1000 columns, giving the shape
that you want. Replicate really won't work here.
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|