I have 3 sets of 10 vectors each, and I want to take 2 vectors from the first set , 2 vectors from the second set and 3 vectors from the third set . My goal is to make a loop to implement the following program, knowing that after each calculation, the result shall be saved in a new file.
My problem is that I can not handle the indices included in the strings. I try to use multiple loops to scan the 3 sets in the order of indices. loops should contain the following program
clc;
clear all;
load('C:\Users\Documents\MATLAB\myFile\matrice_F.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_G.mat');
F = m_F;
G = m_G;
load('C:\Users\Documents\MATLAB\myFile\matrice_J.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_K.mat');
J = m_J;
K = m_K;
load('C:\Users\Documents\MATLAB\myFile\matrice_N.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_O.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_P.mat');
N = m_N ;
O = m_O;
P = m_P;
[A,B,C,D,E] = myFun(F,G,J,K,N,O,P);
file_name = 'matrice_final.mat';
save(file_name,'A','B','C','D','E');
I thank all those who responded to my question. Sorry if I was not as accurate from the outset. However, I would like the program looks something like:
clc;
clear all;
set1={F,G,FF,GG,X,Y,XX,L,BH,JK}; %set of name vectors
set2={J,K,HG,UY,TR,BC,XW,IOP,ES,QA}; %set of name vectors
set3={AJ,RK,DS,TU,WS,ZZE,ZXW,TYP,ZAA,QWW}; %set of name vectors
for i=1:1:9
load('C:\Users\Documents\MATLAB\myFile\matrice_'set1(i)'.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_'set1(i+1)'.mat');
'set1(i)' = m_'set1(i)';
'set1(i+1)' = m_'set1(i+1)';
for j=1:1:9
load('C:\Users\Documents\MATLAB\myFile\matrice_'set2(j)'.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_'set2(j+1)'.mat');
'set2(j)' = m_'set2(j)';
'set2(j+1)' = m_'set2(j+1)';
for k=1:1:8
load('C:\Users\Documents\MATLAB\myFile\matrice_'set3(k)'.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_'set3(k+1)'.mat');
load('C:\Users\Documents\MATLAB\myFile\matrice_'set3(k+2)'.mat');
'set3(k)' = m_'set3(k)' ;
'set3(k+1)' = m_'set3(k+1)';
'set3(k+2)' = m_'set3(k+2)';
[Result1'index',Result2'index',Result3'index',Result4'index',Result5'index'] = myFun('set1(i)','set1(i+1)','set2(j)','set2(j+1)','set3(k)','set3(k+1)','set3(k+2)'); %% 9x9x8=648 index=1,2,...,648
file_name = 'matrice_final'index'.mat';
save(file_name,'Result1'index'','Result2'index'','Result3'index'','Result4'index'','Result5'index'');
clear 'set3(k)' 'set3(k+1)' 'set3(k+2)'
end
clear 'set2(j)' 'set2(j+1)'
end
clear 'set1(i)' 'set1(i+1)'
end