Save each output step in rows in a larger matrix
Show older comments
From the below code I get k number of Q1. I am trying to save each of the Q1 in Row1, Row2, Row3..... Rowk. I have been doing the same for the i and j loop but for some reason its failing when I apply the same thing for the Q1. I appreciate any suggestion.
clc
clear all
S = dir('F.*');
for k = 1:numel(S)
S(k).name;
T = dir('Na-XYZ.*');
for k = 1:numel(T)
T(k).name;
Nadump = dlmread(T(k).name, ' ', 9, 0);
Fdump = dlmread(S(k).name, ' ', 9, 0);
L1 = length(Nadump);
L2 = length(Fdump);
for i=1:L1
for j=1:L2
X(i)= sqrt((Fdump(j,3)-Nadump(i,3))^2 + (Fdump(j,4)-Nadump(i,4))^2 + (Fdump(j,5)-Nadump(i,5))^2);
X(i) = X(i)/10;
Y(j,i) = sort(X(i));
end
end
Y1 = Y';
Y2 = sort(Y1);
S1= sort ((Y2(1,:))');
ind1 = S1(:,1) < .28;
ind2 = S1(:,1) < .55;
ind3 = S1(:,1) < .79;
A1 = S1(ind1,:);
A2 = S1(ind2,:);
A3 = S1(ind3,:);
Q1 = [length(A1), (length(A2)-length(A1)), length(A3)-length(A2), 125-length(A3)];
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!