Saving unique row vector after computations in loop

This code is doing 90% of what I need. I just cant get a unique vector each time through the code. I get MATLAB to reach into file and load 23 text files. It plots each file, I then capture C1, C2, ...C6 data points by hand, close the plot window, make basic x,y computations then save these results in a row vector. I need a unique vector for each data set, ie, each time through the loop. Any input would be greatly appreciated.
clear;
files = dir('*.txt');
for i = 1:length(files)
data = load(files(i).name, '-ascii');
x = data(:,1);
y = data(:,2);
plot(x,y);
uiwait; % pause loop until fig closed
% Get benchmarks and compute vector
p = C2.Position(2) - C1.Position(2);
q = C3.Position(2) - C2.Position(2);
r = p + q;
s = C2.Position(1) - C1.Position(1);
t = C3.Position(1) - C2.Position(1);
u = s + t;
z = C4.Position(1) - C3.Position(1);
a = C5.Position(2) - C4.Position(2);
b = C6.Position(2) - C5.Position(2);
c = a + b;
d = C5.Position(1) - C4.Position(1);
e = C6.Position(1) - C5.Position(1);
f = d + e;
V(i) = [p,s,q,t,r,u,z,a,d,b,e,c,f]; % desired row vector
drawnow;
end

1 Comment

Please format your question:
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

Sign in to comment.

Answers (1)

Got it with this:
COMPS = [(C2.Position(2) - C1.Position(2)), (C3.Position(2) - C2.Position(2)) ....... ];
ALLCOMPS(i,:) = COMPS;
Brian

Categories

Find more on App Building in Help Center and File Exchange

Asked:

on 30 May 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!