Converting Single dimensional vector or array to two dimension in Matlab

Posted by pac on Stack Overflow See other posts from Stack Overflow or by pac
Published on 2012-04-01T17:11:24Z Indexed on 2012/04/01 17:29 UTC
Read the original article Hit count: 219

Filed under:

Well I do not know if I used the exact term. I tried to find an answer on the net. Here is what i need: I have a vector

                                  a = 1  4  7 

                                      2  5  8

                                      3  6  9

If I do a(4) the value is 4. So it is reading first column top to buttom then continuing to next .... I don't know why. However,

What I need is to call it using two indices. As row and column:

                                  a(3,2)= 4

or even better if i can call it in the following way:

                                  a{3}(2)=4

What is this process really called (want to learn) and how to perform in matlab. I thought of a loop. Is there a built in function Thanks a lot

Check this: a =

18    18    16    18    18    18    16     0     0     0
16    16    18     0    18    16     0    18    18    16
18     0    18    18     0    16     0     0     0    18
18     0    18    18    16     0    16     0    18    18

>> a(4)
  ans =
  18

>> a(5)
  ans =
  18

>> a(10)
  ans =
  18

I tried reshape. it is reshaping not converting into 2 indeces

© Stack Overflow or respective owner

Related posts about matlab