Create a matrix using repmat [message #36723] |
Wed, 22 October 2003 01:58  |
dino.nicola
Messages: 7 Registered: October 2003
|
Junior Member |
|
|
I need to translate the Matlab REPMAT command in IDL code. I mean
B=repmat(A,m,n) is used in Matlab to create a large matrix B
consisting of an m by n tiling copies of A. How can I do? Thank you in
advance, Dino.
|
|
|
Re: Create a matrix using repmat [message #36800 is a reply to message #36723] |
Fri, 24 October 2003 08:51  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Christopher Lee writes:
> ; courtesy Fanning and Smith, code-crime fighting duo :)
Uh, I think that should be "Smith and Fanning". I just
write down what he tells me to write down. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Create a matrix using repmat [message #36801 is a reply to message #36723] |
Fri, 24 October 2003 08:40  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <688447c0.0310220058.43dcfe77@posting.google.com>, "dino
nicola" <dino.nicola@libero.it> wrote:
> I need to translate the Matlab REPMAT command in IDL code. I mean
> B=repmat(A,m,n) is used in Matlab to create a large matrix B consisting
> of an m by n tiling copies of A. How can I do? Thank you in advance,
> Dino.
It depends on which version of IDL you have, post IDL 5.6 (I think) you
can use reform and rebin to do it.
#assuming A is...
A=fltarr(x,y)
B = rebin(reform(A, [x,y,1,1]),[x,y,m,n])
;or B =rebin(reform(A, [1,1,x,y]), [m,n,x,y]) ...etc
; courtesy Fanning and Smith, code-crime fighting duo :)
pre IDL 5.6 take the square brackets away and it should still work.
Chris.
|
|
|