Wednesday 15 July 2015

matlab - usre array elements as a index -


Let's assume we have followed the array declaration in the matrix

  a = [1 2 3; 4 5 6; 7 8 9]   

which normally appears in the form of matab

a =

  1 2 3 4 5 6 7 8 9 I know how the following code works  

[aa (a)]

Here the answer is definitely from the book

  ans = 1 2 3 1 4 7 4 5 6 2 5 8 7 8 9 3 6 9 < / Code>  

As I first understand the number of a bracket simple display original one, or 1 to 9, the second case is to use array elements in the array, then it means that the exmaple number For this, 1 2 3 4 5 6 7 8 9

This is an index for array, first index a [1] = 1, a {2] = 2, a [3] = 3 .... a [9] = 9 Is this right? But why is it printed in a way to change? Should not it be like the original matrix? Thanks a lot

In this case the rows are broken before the column one [2] = 4 , a [3] = 7 and a [4] = 2

No comments:

Post a Comment