1
$\begingroup$

I am working with two matrices (because I have more matrices with indices (1,2,3,...) I write them below in specific format i. e. m1[1] and m2[1])

m1[1]={{-1, 1, 0, -1, -1}, {-1, -1, 1, -1, -1}, {-1, 1, -1, -1, 0}, {0, 1, -1, -1, -1}, {-1, 1, -1, -1, 1}};
m2[1]={{2, 0, 1, 1, 0}, {2, 2, 2, 0, 1}, {2, 2, 2, 1, 0}, {1, 1, 2, 0, 2}, {1, 1, 1, 0, 0}};

with the below code I can gain eigenvectors in any iterations

Do[n=1; list[n,Round[10*i+1]]=Eigenvectors[m2[1]+i*m1[1]],{i,0,1,0.1}];

For example for: n=1, 10*i+1=1 we have

list[1,1]={{-0.286453 + 0. I, -0.553253 + 0. I, -0.587952 + 0. I, -0.449042 + 
0. I, -0.254027 + 0. I},  {-0.634291 + 0. I, 0.226217 + 0.328308 I, 
   0.365464 - 0.211538 I, 0.463629 - 0.163831 I, 
  0.0476698 + 0.127813 I}, {-0.634291 + 0. I, 0.226217 - 0.328308 I, 
  0.365464 + 0.211538 I, 0.463629 + 0.163831 I, 
  0.0476698 - 0.127813 I}, {-0.0911882 + 0.0499775 I, 
 0.387005 + 0.0525471 I, -0.486037 - 0.163308 I, 0.69333 + 0. I, 
  0.163778 + 0.257335 I}, {-0.0911882 - 0.0499775 I, 
  0.387005 - 0.0525471 I, -0.486037 + 0.163308 I, 0.69333 + 0. I, 
   0.163778 - 0.257335 I}}

by these indices we have

list[1,1][[1]]={-0.286453 + 0. I, -0.553253 + 0. I, -0.587952 + 0. I, 
               -0.449042 +  0. I, -0.254027 + 0. I};

list[1,1][[2]]={-0.634291 + 0. I, 0.226217 + 0.328308 I, 
   0.365464 - 0.211538 I, 0.463629 - 0.163831 I, 
  0.0476698 + 0.127813 I};

and so on.

DESIRED CASE: I eagerly wish to save all eigenvectors in the individual text files by the special names. These names should be written in the format:

n-1-i-1-eig-1 and n-1-i-1-eig-2......n-1-i-1-eig-5 according to the eigenvectors
list[1,1][[1]]......list[1,1][[5]]. Furthermore, for 2i+1=2, I wish to have text files with the names : n-1-i-2-eig-1 and n-1-i-2-eig-2......n-1-i-2-eig-5. And any of them will be a column of the numbers.

I have seen many posts such as this, this, this, this and other related to exportation. But they have not helped me to choose a specific name for the exported files.

However based on the @Erich Mueller in this question this link, I can use just a list without any indices but I am comfortable to exploit of those.

$\endgroup$
  • $\begingroup$ what do you want to do with the text file? Just read it back by mathematica, use '.m' or 'Package' format. (because of the complex numbers ) $\endgroup$ – george2079 Jun 5 '17 at 20:16
  • $\begingroup$ Yes, I have to use them in another program of course by Mathematica. By the method in [https : // mathematica.stackexchange.com/questions/22357/importing - multiple - files - using - a - for - loop] I can import them in another program. But if I cannot save them, once I shut down my computer, all data will be lost. $\endgroup$ – Inzo Babaria Jun 5 '17 at 20:35
  • $\begingroup$ "CSV" format might be better for some other program to read. $\endgroup$ – george2079 Jun 5 '17 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.