comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Create a matrix using repmat
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Create a matrix using repmat [message #36723] Wed, 22 October 2003 01:58 Go to next message
dino.nicola is currently offline  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 Go to previous message
David Fanning is currently offline  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 Go to previous message
Chris Lee is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Non-zero diagonals for sparse format
Next Topic: color_quan - how for exactly 256 colors?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 20:22:34 PDT 2025

Total time taken to generate the page: 0.87774 seconds