DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

convert vector to matrix

Acquiring 3D data, f(x,y). It is stored as a vector and read into Diadem that way. For example, if NX=5, NY=10, then 1st 10 points are for IX=1, next 10 are for IX=2, etc. The Diadem channel length is 50. I want to convert it to a matrix so that I can do a 3D surface plot. I know the values of NX and NY and can build the x, y channels. Is there a function that already does this or do I need to write a script?

 

Version 10.1 of Diadem.

0 Kudos
Message 1 of 4
(4,101 Views)

Hi Steve,

 

First make sure that the X channel and Y channel you create have exactly 50 points, just like the Z channel data you imported.  Then look in DIAdem ANALYSIS under the "3D Basic Functions" palette and find the "Convert Matrix" function.  This will convert either from matrix to triplet or from triplet to matrix-- you want the latter.

 

Let us know if you need further assistance,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(4,090 Views)

Brad,

 

OK. The real data has a large NY. One example has NY=5001 and NX=11. The Y and Z channels have the correct format with 55011 pts/each, because that is how the data was originally put into a file. Now I need to generate an X-channel that is 5001 repeats of x(1), then 5001 repeats of x(2), then 5001 repeats of x(3).... Is there a way to do that?

 

Steve

0 Kudos
Message 3 of 4
(4,083 Views)

Hi Steve,

 

Try this:

 

XChanName = "X Channel"
YValues = 5001
XValues = Array("", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110)
IF CNo(XChanName) > 0 THEN Call ChnDelete(XChanName)
ChanArray = ChnAlloc(XChanName, YValues*UBound(XValues), 1)
XChNum = CNo(ChanArray(0))
ChnLength(XChNum) = YValues*UBound(XValues)
FOR i = 1 TO UBound(XValues)
  FOR j = 1 TO YValues
    k = k + 1
    ChDX(k, XChNum) = XValues(i)
  NEXT ' j
NExT ' i
Call ChnCharacter(XChNum)

 

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 4
(4,076 Views)