Karhunen-Loeve Matlab code I am trying to learn about KL Transform. I found this code. I am struggling to understand how does [v{m},d{m}]=eig(img_covariance); differ from [v2,d2]=eig(img_covariance);, The former returns two matrices of eigenvectors, from which the second (v{2})  is equal to v2. But what is the first one (v{1})?
edit
[v{m},d{m}]=eig(img_covariance) returns
v =
{
[1,1] =
Columns 1 through 7:
-0.1527903   0.0106995   0.3204241  -0.3014430   0.4620154  -0.1584354  -0.6386134
-0.3718077  -0.0753980  -0.2576876   0.4059503  -0.0168094   0.1363366   0.1615412
-0.0891184  -0.4056759  -0.5148526  -0.4301809  -0.0897367   0.5362251  -0.2778373
 0.0766357  -0.6346157   0.2506626  -0.2101475  -0.5053394  -0.4192726   0.0629048
 0.2579611  -0.4219268   0.1987889   0.6808135   0.0608045   0.2408053  -0.4032314
 0.6361581  -0.0522523  -0.5627216   0.0296577   0.2797814  -0.4008548  -0.0401111
 0.5044345  -0.0534348   0.3831791  -0.2251705   0.1993863   0.5035803   0.3835550
 0.3144897   0.4932372   0.0046623   0.0055295  -0.6333316   0.1439403  -0.4166628

Column 8:
 0.3696135
 0.7615181
-0.0676208
 0.2219948
-0.1677195
 0.1856510
 0.3235740
 0.2496506

[1,2] =
Columns 1 through 7:
 0.3696135  -0.6386134  -0.1584354   0.4620154  -0.3014430   0.3204241   0.0106995
 0.7615181   0.1615412   0.1363366  -0.0168094   0.4059503  -0.2576876  -0.0753980
-0.0676208  -0.2778373   0.5362251  -0.0897367  -0.4301809  -0.5148526  -0.4056759
 0.2219948   0.0629048  -0.4192726  -0.5053394  -0.2101475   0.2506626  -0.6346157
-0.1677195  -0.4032314   0.2408053   0.0608045   0.6808135   0.1987889  -0.4219268
 0.1856510  -0.0401111  -0.4008548   0.2797814   0.0296577  -0.5627216  -0.0522523
 0.3235740   0.3835550   0.5035803   0.1993863  -0.2251705   0.3831791  -0.0534348
 0.2496506  -0.4166628   0.1439403  -0.6333316   0.0055295   0.0046623   0.4932372

Column 8:
-0.1527903
-0.3718077
-0.0891184
 0.0766357
 0.2579611
 0.6361581
 0.5044345
 0.3144897

}
d =
{
[1,1] =
Diagonal Matrix
Columns 1 through 7:
 1.1972e-16            0            0            0            0            0            0
          0   2.9076e-05            0            0            0            0            0
          0            0   1.8829e-03            0            0            0            0
          0            0            0   2.2148e-03            0            0            0
          0            0            0            0   3.6073e-03            0            0
          0            0            0            0            0   5.4175e-03            0
          0            0            0            0            0            0   2.1080e-02
          0            0            0            0            0            0            0

Column 8:
          0
          0
          0
          0
          0
          0
          0
 2.9485e-02

[1,2] =
Diagonal Matrix
Columns 1 through 7:
 1.1972e-16            0            0            0            0            0            0
          0   2.9076e-05            0            0            0            0            0
          0            0   1.8829e-03            0            0            0            0
          0            0            0   2.2148e-03            0            0            0
          0            0            0            0   3.6073e-03            0            0
          0            0            0            0            0   5.4175e-03            0
          0            0            0            0            0            0   2.1080e-02
          0            0            0            0            0            0            0

Column 8:
          0
          0
          0
          0
          0
          0
          0
 2.9485e-02

}
My question is, what is the first matrix in v?
By Matlab documentation for eig() function:

[V,D] = eig(A) returns diagonal matrix D of eigenvalues and matrix V
whose columns are the corresponding right eigenvectors, so that AV =
VD.

If I understood your question, in linked code, eig() is calculated m times in a loop (to get values for cell arrays v{m}, d{m}) when v2 and d2 holds results just from one eig() call.
EDIT:
I don't have the picture you used so, I tested code (from your link) with an image (cameraman.tif) found from here and got this data:

By results, v{1} and v{2} are:
&gt;&gt; v{1}
ans =

 Columns 1 through 6:

  -4.0138e-01  -1.4572e-02  -1.2048e-01   2.3176e-01   4.1139e-01  -3.1815e-01
   4.3686e-01  -1.2307e-01  -3.9978e-01   2.7047e-01   2.2728e-01   9.6813e-02
  -4.0138e-01  -1.4572e-02  -1.2048e-01   2.3176e-01   4.1139e-01  -3.1815e-01
   4.3686e-01  -1.2307e-01  -3.9978e-01   2.7047e-01   2.2728e-01   9.6813e-02
   2.9537e-01  -5.6967e-01   5.2108e-01   2.9155e-01  -1.0665e-01  -4.6940e-01
   3.6360e-01   5.5112e-01   5.2095e-01  -2.1498e-02   5.4056e-01   2.0849e-03
   2.5115e-01  -1.7181e-02  -2.8419e-01  -7.0205e-01   9.6838e-02  -5.9465e-01
   1.1653e-01   5.8372e-01  -1.6628e-01   4.0979e-01  -4.9522e-01  -4.5263e-01

 Columns 7 and 8:

  -3.8642e-01  -5.9218e-01
   5.9218e-01  -3.8642e-01
   3.8642e-01   5.9218e-01
  -5.9218e-01   3.8642e-01
  -2.1553e-16   2.7222e-16
  -1.8265e-16   2.3956e-16
  -3.8696e-16   2.5427e-16
  -1.0408e-16   9.0464e-17

&gt;&gt; v{2}
ans =

 Columns 1 through 6:

   9.0501e-02  -1.2846e-01   1.4943e-01  -2.9304e-01  -5.9191e-01   1.2941e-01
   3.8163e-01  -9.8168e-02  -4.8404e-02  -3.8589e-01   3.2360e-01   2.9791e-01
   9.0501e-02  -1.2846e-01   1.4943e-01  -2.9304e-01  -5.9191e-01   1.2941e-01
   3.8163e-01  -9.8168e-02  -4.8404e-02  -3.8589e-01   3.2360e-01   2.9791e-01
   4.6546e-01  -2.4078e-01   7.1522e-01   2.2122e-01   1.0894e-01  -3.9119e-01
   5.7975e-01   6.1828e-01  -3.3337e-01   7.0850e-03  -2.1081e-01  -3.5495e-01
   2.2974e-01   2.2265e-01   1.4556e-01   6.0005e-01  -1.1856e-01   7.0876e-01
   2.9460e-01  -6.7668e-01  -5.5389e-01   3.4841e-01  -1.3955e-01  -8.7478e-02

 Columns 7 and 8:

  -3.9894e-01  -5.8382e-01
  -5.8382e-01   3.9894e-01
   3.9894e-01   5.8382e-01
   5.8382e-01  -3.9894e-01
   4.1426e-16  -1.3694e-16
   2.5085e-16  -2.6656e-17
  -6.0554e-16   8.3807e-17
   6.6451e-17  -1.3088e-17

At which point you take the value for v2 and d2 since AFAIK, if you take them at &quot;position&quot; m then data should be equal with the mth one v's and m's?