[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: Help*From*: Pavel Romashkin <promashkin(at)cmdl.noaa.gov>*Date*: Fri, 21 May 1999 15:07:32 -0600*Newsgroups*: comp.lang.idl-pvwave*Organization*: NOAA - CIRES*References*: <37456C53.A2FED93D@info.fundp.ac.be>*Reply-To*: promashkin(at)cmdl.noaa.gov*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:14870

The task is not strictly defined: the two matrices Tri provided are different in size. Therefore, I treated it as a general problem. Here is a 1-line solution for any size matrix: print, (bindgen(k*m+m-1, x) mod m) eq 0 Here, m is the length of the cycle within a row, k is an integer multiplier to obtain the necessary row length, x - arbitrary number of rows. Example with m=4, k=3, x=5: IDL> print, (bindgen(3*4+3, 5) mod 4) eq 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 Resulting matrix can be trimmed in any fashion you desire. Or, maybe I could just type matrices in, if they were needed precisely and only in the way Tri sent them?... Cheers, Pavel Tri VU KHAC wrote: > Hi folks, > > I'm looking for an efficient way to produce the matrix of type (I woulk > like to be able to avoid the FOR statement) > > 0 1 0 1 0 1 0 1 > 1 0 1 0 1 0 1 0 > 0 1 0 1 0 1 0 1 > 1 0 1 0 1 0 1 0 > > OR > > 1 0 0 1 0 0 1 > 0 1 0 0 1 0 0 > 0 0 1 0 0 1 0 > 1 0 0 1 0 0 1 > > ETC. > > Best regards, > Tri.

**References**:**Help***From:*Tri VU KHAC

- Prev by Date:
**When you can't concatenate structures like you expect....** - Next by Date:
**Re: behavior of arrays** - Prev by thread:
**Help** - Next by thread:
**When you can't concatenate structures like you expect....** - Index(es):