Hello,
I don't if it is even possible but I have 9 files with the same name except his number (1, ... 9) = "SiON_D6_L8.5_12Lyrs_NUMBER_CHANGE_HERE_umOfDistance_Ex.txt"
These txt files are 941x2 sized arrays. I need to open this file and find the maximum value within the values in the second column and then continue to do my accounts. The problem is that I am doing it one by one, that is, I have 9 files and I have to copy the program bellow nine times. My goal is to find the radius of the nine file and in the end I will plot the 9 radius together to compare.
Is it some way to do with a loop? Like I can index the file (1,...9) and when I want to access the file I just index it.
clear all;
file1 = load('SiON_D6_L8.5_12Lyrs_1umOfDistance_Ex.txt');
E1 = file1(:,2);
Y1 = file1(:,1);
M1 = max(E1(:));
m1 = M1*0.37;
endij1 = round(length(E1)/2);
for i1 = 1:endij1
if E1(i1) >= m1
x1(i1) = Y1(i1);
y1(i1) = E1(i1);
end
end
for j1 = endij1:length(E1)
if E1(j1) >= m1
x21(j1) = Y1(j1);
y21(j1) = E1(j1);
end
end
for d1 = 1:length(x1)
if x1(d1) ~= 0
x_data1(d1) = x1(d1);
else
x_data1(d1) = 1000;
end
end
a1 = min(x_data1);
b1 = max(x21);
radius1 = b1-a1;
file2 = load('SiON_D6_L8.5_12Lyrs_2umOfDistance_Ex.txt');
E2 = file2(:,2);
Y2 = file2(:,1);
M2 = max(E2(:));
m2 = M2*0.37;
endij2 = round(length(E2)/2);
2 Comments
Direct link to this comment
https://ww2.mathworks.cn/matlabcentral/answers/576037-how-can-i-save-multiple-matrix-and-index-them#comment_963700
Direct link to this comment
https://ww2.mathworks.cn/matlabcentral/answers/576037-how-can-i-save-multiple-matrix-and-index-them#comment_963700
Direct link to this comment
https://ww2.mathworks.cn/matlabcentral/answers/576037-how-can-i-save-multiple-matrix-and-index-them#comment_969594
Direct link to this comment
https://ww2.mathworks.cn/matlabcentral/answers/576037-how-can-i-save-multiple-matrix-and-index-them#comment_969594
Sign in to comment.