how to go from X(i,j,k) to Y((i,j),k) ?

P

poyraz.kayabas

Hi All,

I have a 3-dimensional data set

It is a N x N x N matrix

In other words cells are X(i,j,k) for i,j,k =N

--------------
Here is my problem:

I want to create a table to represent this data. Since it is 3-dim, I
need a 2-dim matrix.
-------------

Question:

I want to make a matrix/ table for each (i,j) pair versus k

So it is going to be a 2-dim N*N x N matrix.

-----------------------------------------------
EXAMPLE: for N=2

I have this
i j k
X(1,1,1)=a
X(1,1,2)=b
X(1,2,1)=c
X(1,2,2)=d
X(2,1,1)=e
X(2,1,2)=f
X(2,2,1)=g
X(2,2,2)=k

But I need this

(i,j) k
Y((1,1),1)=a
Y((1,1),2)=b
Y((1,2),1)=c
Y((1,2),2)=d
Y((2,1),1)=e
Y((2,1),2)=f
Y((2,2),1)=g
Y((2,2),2)=k

Actually I need this

k= 1 2
(i,j)
(1,1) a b
(1,2) c d
(2,1) e f
(2,2) g k

And I have no idea about how to do this. And my N is 65 :-(

Thanks in advance.
 
V

Victor Bazarov

I have a 3-dimensional data set

It is a N x N x N matrix

In other words cells are X(i,j,k) for i,j,k =N

You mean, "for i,j,k =[1..N]", or in C++ "for i,j,k =[0..N-1]".
--------------
Here is my problem:

I want to create a table to represent this data. Since it is 3-dim, I
need a 2-dim matrix.

Why? Is that a homework assignment?
-------------

Question:

I want to make a matrix/ table for each (i,j) pair versus k

So it is going to be a 2-dim N*N x N matrix.

-----------------------------------------------
EXAMPLE: for N=2

I have this
i j k
X(1,1,1)=a
X(1,1,2)=b
X(1,2,1)=c
X(1,2,2)=d
X(2,1,1)=e
X(2,1,2)=f
X(2,2,1)=g
X(2,2,2)=k

But I need this

(i,j) k
Y((1,1),1)=a
Y((1,1),2)=b
Y((1,2),1)=c
Y((1,2),2)=d
Y((2,1),1)=e
Y((2,1),2)=f
Y((2,2),1)=g
Y((2,2),2)=k

Actually I need this

k= 1 2
(i,j)
(1,1) a b
(1,2) c d
(2,1) e f
(2,2) g k

And I have no idea about how to do this. And my N is 65 :-(

If you think that your 'i,j' pair is a two-digit N-based number, then
you should be able to calculate its value 'ij' using a simple enough
formula involving 'i', 'j', and 'N'... For example, for N==42, i==7
and j==33 it woule be 327.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,177
Latest member
OrderGlucea
Top